Eugeny / tabby-docker

Docker plugin for Tabby
46 stars 3 forks source link

Attach to container running on a remote docker host #17

Open sjtuross opened 2 years ago

sjtuross commented 2 years ago

Is there a way to specify DOCKER_HOST and then attach to a container running there?

mikeburgh commented 2 years ago

It looks like dockerode supports it (as well as passing in the connection string) https://github.com/apocas/dockerode/issues/568

Eugeny commented 2 years ago

Done in tabby-docker 0.2.0

mikeburgh commented 2 years ago

Does not seem to be working with an ssh based socket path:

profiles.ts:43 Could not load Docker containers: Error: connect ENOENT ssh://mike@[ip here] at node_internal_captureLargerStackTrace (node:internal/errors:464:5) at node_internal_exceptionWithHostPort (node:internal/errors:642:12) at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)

If I use the docker cli then it works with the same ssh path provided

Eugeny commented 2 years ago

It only supports actual host/port TCP connections for now, sorry. The ssh:// DOCKER_HOST URLs rely on using OpenSSH in the background. I suppose I could add support for tunnelling the connection through an SSH profile in Tabby but that's low priority given that there's an easy workaround of setting up an SSH port forward in Tabby itself.

mikeburgh commented 2 years ago

Ahh I had assumed if you passed the ssh:// part through to the dockerode it would handle it, since the modem it uses seems to have a built in ssh agent: https://github.com/apocas/docker-modem and from reading through dockerode, it should work if you set the protocol to ssh from http (and the other details that go with the connection). Although it still raises issues around key auth which seems to be a hassle https://github.com/apocas/docker-modem/pull/119#issuecomment-703002880

All good, I will try out the tunnel model to see if I can get it to play nice

sjtuross commented 2 years ago

Thank you for getting this feature implemented. Per my test, it only works using non-secure TCP connection (default port 2375), but I'm unable to connect to a host protected by either TLS (port 2376) or SSH.

Gaibhne commented 2 years ago

Would be really nice if the ssh://-functionality could be retrofitted, as like I would think most companies mine has a policy not to expose the raw Docker daemon, so SSH is the only viable path.