-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
cli/connhelper: support overriding the docker binary over SSH #5627
base: master
Are you sure you want to change the base?
cli/connhelper: support overriding the docker binary over SSH #5627
Conversation
951dcee
to
1fdc2b8
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5627 +/- ##
=======================================
Coverage 59.50% 59.51%
=======================================
Files 346 346
Lines 29365 29371 +6
=======================================
+ Hits 17474 17480 +6
Misses 10916 10916
Partials 975 975 |
cli/connhelper/connhelper.go
Outdated
@@ -49,7 +56,7 @@ func getConnectionHelper(daemonURL string, sshFlags []string) (*ConnectionHelper | |||
sshFlags = disablePseudoTerminalAllocation(sshFlags) | |||
return &ConnectionHelper{ | |||
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) { | |||
args := []string{"docker"} | |||
args := []string{dockerSSHRemoteBinary()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this inside of the Dialer
means that it'll possibly get evaluated multiple times during a single CLI invocation – so, if something unexpected happens causing the environment variable to get unset while the process is running and Dialer
gets called again a different value would get returned.
I think it'd be safer to move this evaluation up to L56 to make sure it only happens once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something like
remoteDockerBinary := dockerSSHRemoteBinary()
return &ConnectionHelper{
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
args := []string{remoteDockerBinary}
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point – thanks @laurazard! I've updated as suggested.
f5737e8
to
82352ff
Compare
This change adds the ability to override the docker binary used when executing commands over SSH. This is useful when the docker binary is not in the PATH of the SSH user, or when the binary is not named `docker`. If `DOCKER_SSH_REMOTE_BINARY` is set in the environment, the value will be used as the docker binary when executing commands over SSH. If the environment variable is not set, the default value of `docker` will be used. Signed-off-by: Matthew MacLeod <matt@umm.io>
Signed-off-by: Matthew MacLeod <matt@umm.io>
82352ff
to
43dd6ea
Compare
This change adds the ability to override the docker binary used when executing commands over SSH. This is useful when the docker binary is not in the PATH of the SSH user, or when the binary is not named
docker
.If
DOCKER_SSH_REMOTE_BINARY
is set in the environment, the value will be used as the docker binary when executing commands over SSH. If the environment variable is not set, the default value ofdocker
will be used.Closes #5626
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)