[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tramp-container doesn't follow `ENV PATH` in docker file
From: |
Michael Albinus |
Subject: |
Re: tramp-container doesn't follow `ENV PATH` in docker file |
Date: |
Thu, 16 Mar 2023 10:55:30 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
ParetoOptimalDev <pareto.optimal@mailfence.com> writes:
Hi,
> I made some progress and I figured out how to get the `ENV PATH` value
> with a weird hacky feeling method:
Just for the records: I have seen also your first message. Since the
times are busy, I have postponed to answer. However, I agree we need to
do something in this area.
> #+begin_src sh
> docker run -t haskell bash -c 'env PATH=$PATH bash -c "echo $PATH"'
> #+end_src
>
> #+RESULTS:
> :
> /root/.cabal/bin:/root/.local/bin:/opt/ghc/9.4.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
>
> I tried to modify the `tramp-docker-method` in `tramp-methods` to
> utilize the above command but it didn't work.
>
> Here was my attempt:
>
> (add-to-list 'tramp-methods
> `(,tramp-docker-method
> (tramp-login-program ,tramp-docker-program)
> (tramp-login-args (("exec")
> ("-it")
> ("-u" "%u")
> ("%h")
> ("%l")
> ))
> (tramp-direct-async (,tramp-default-remote-shell "-c"))
> (tramp-remote-shell ,tramp-default-remote-shell)
> (tramp-remote-shell-login ("-l"))
> (tramp-remote-shell-args ("-i" "-c" "'env
> PATH=$PATH'"))))
>
> Can anyone help with this?
Well, where does $PATH come from? Should it be your local $PATH on the
machine you're calling docker?
Note, that your change wouldn't do anything. The $PATH on the docker
instance is computed in the remote shell, based on tramp-remote-path. If
you want to change something, it must be there.
This mechanism is questionable in general. There is already the Emacs
bug#61926, which asks for something else. This request is currently
pending (due to other prioritzed work); when I'll work on this I will
also take your request into account. If you like, you could also send a
message to that bug number, requesting proper changes for docker. Just
in case nobody forgets it.
Best regards, Michael.