Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: support DOCKER_HOST=ssh://... remotes #4607

Merged
merged 2 commits into from
Jun 4, 2021
Merged

Conversation

milas
Copy link
Contributor

@milas milas commented Jun 2, 2021

Docker 18.09+ added support for SSH remote Docker connections.
The code to handle this isn't actually in the Moby client portions
that we use, but in the Docker CLI (which we already have a
dependency on).

This adapts some of the code from the Docker CLI that attempts
to create a ConnectionHelper if the host value is set. Currently,
the logic only creates a helper for ssh:// hosts and returns nil
otherwise, in which case the former logic is used (i.e. pass the
host as-is to Moby). If a connection helper is created, it's used
to create a custom HTTP client/transport that will use SSH under
the hood.

Fixes #4603.

@milas milas requested review from maiamcc and landism June 2, 2021 20:01
Docker 18.09+ added support for SSH remote Docker connections.
The code to handle this isn't actually in the Moby client portions
that we use, but in the Docker CLI (which we already have a
dependency on).

This adapts some of the code from the Docker CLI that attempts
to create a `ConnectionHelper` if the host value is set. Currently,
the logic only creates a helper for `ssh://` hosts and returns nil
otherwise, in which case the former logic is used (i.e. pass the
host as-is to Moby). If a connection helper is created, it's used
to create a custom HTTP client/transport that will use SSH under
the hood.

Fixes #4603.
@milas milas force-pushed the milas/docker-ssh-host branch 2 times, most recently from 52e4b19 to a1e0352 Compare June 3, 2021 12:43
@milas
Copy link
Contributor Author

milas commented Jun 3, 2021

Unfortunately, there's no great way to test this in CI that I can find. CircleCI actually configures the remote docker to be SSHable (docs) but there's enough other complexity/weirdness with port forwarding etc that it doesn't seem practical.

@landism
Copy link
Member

landism commented Jun 3, 2021

Unfortunately, there's no great way to test this in CI that I can find. CircleCI actually configures the remote docker to be SSHable (docs) but there's enough other complexity/weirdness with port forwarding etc that it doesn't seem practical.

If the next person to touch this is tempted to add a test, having some form of this comment in the code might save them some time.

@milas
Copy link
Contributor Author

milas commented Jun 4, 2021

Good call - added a note in 61089f5. I really wanted to get a variation of one of the integration tests working, but there's just too many oddities to make it practical right now

@milas milas merged commit 9982b4f into master Jun 4, 2021
@milas milas deleted the milas/docker-ssh-host branch June 4, 2021 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOCKER_HOST using ssh protocol makes tilt up fail
2 participants