From: Michael Albinus <michael.albi...@gmx.de>
Subject: Re: tramp (2.6.1 HEAD/3ff676c2f98cb6c47fecb37f31a589a910dd3876);
 docker-container ssh multi-hop support
To: Gene Goykhman <g...@indigo1.com>
Cc: tramp-devel@gnu.org, Protesilaos Stavrou <pub...@protesilaos.com> Date: Mon, 24 Jul 2023 09:45:53 +0200 (1 week, 9 hours, 10 minutes ago)
Flags: seen, list
Maildir: /mailbox/Inbox/TRAMP Dev

Gene Goykhman <g...@indigo1.com> writes:

Hello and thank you for making TRAMP amazing!

Hi Gene,


Hello, I saw this thread and wanted to jump in with some thoughts.

I don't know whether this is a bug or currently unsupported
functionality, but I am trying to get docker-container support through an ssh connection and it is not working. docker-container works fine for
docker running on the local machine.

However:

  M-x find-file RET /ssh:root@remotehost|docker:

Also suggests the SAME list of docker containers running on the local host, rather than the (expected) list of containers on remotehost.

Yes, this is a general weakness of Tramp, for all methods. It doesn't
complete user and host names for multi-hop names but the first
hop. Perhaps I shall add something which doesn't offer completion in
this case.


A very simple change I tried when previously trying to get multihop completion working with another backend was that if I changed the variable `tramp-compat-temporary-file-directory' for the function `temporary-file-directory' in the completion functions (like `tramp-container--completion-function'), then at least we get completion when we are on the remote server. It doesn't give us completion for a multi-hop when we are starting in the local computer but if we first jump to the remote host and then try a multi-hop, we get completion for the container names.

Now their may reasons why we shouldn't call `temporary-file-directory' that I don't know about.


But for a more general solution; would it be possible to parse the whole tramp path while doing the completion and setting the `default-directory'
depending on where in the multi-hop path we are at the moment?
So when we are past "/ssh:user@host|" we start setting the default-directory to a tmp dir on "user@host".

Another issue that I found, which maybe is unavoidable, is that some of the completion functions in `tramp-container' requires that the container program is installed on the local host, but sometimes I only have those programs installed on the remote host. Which stop the completion from working.

I tried ignoring the (incorrect) completion candidates and manually typing the name of the
running docker container on the remote host as follows:

M-x find-file RET /ssh:root@remotehost|docker:remotecontainername

But that opened a new, empty buffer in Fundamental mode and emitted the
error: "File not found and directory write-protected"

This misses the trailing colon, you need

M-x find-file RET /ssh:root@remotehost|docker:remotecontainername:

Is using TRAMP to connect to docker containers running on a remote host via ssh (i.e. multihop) supported? If so, could you point me to some information or
instructions?

Yes, it is supported. I test it regularly with the regression tests. If it still doesn't work for you, pls set tramp-verbose to 6 and rerun the
test. Show the resulting Tramp debug buffer.

Thank you!

Best regards, Michael.


--
Best Regards
Kristofer

Reply via email to