skaffold: Skaffold does not work when using remote docker over ssh
Expected behavior
Using skaffold in an environment where DOCKER_HOST=ssh://somehost is defined should work, as this is a supported docker transport method.
Actual behavior
Skaffold tries to connect over http to the given host, ignoring the ‘ssh://’ part
Information
- Skaffold version: v1.22.0
- Operating system: Windows
- Installed via: Scoop
Steps to reproduce the behavior
- Run docker on a remote host that you can also connect with ssh
- Set environment variable
DOCKER_HOST=ssh://yourhost - Run
skaffold devon a project
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (6 by maintainers)
You can forward socket file using
sshand-Loption. For example:Where
/var/run/docker.sockis thedockerdsocket file on remote machinedocker-remote-host.example.comThen you can use this local socket to forward queries to remote dockerd:
As you may know, running docker with tcp basically GIVES ANYONE WHO CAN REACH THIS PORT ROOT ACCESS TO THE MACHINE. https://docs.docker.com/go/attack-surface/
That being said:
On the remote machine:
Add an override to your systemd docker configuration:
This will open the editor, edit it so the first lines look like:
Restart your docker service on the remote machine:
On your machine:
Let’s say the remote machine is 192.168.0.20:
Now, when you want to use the remote machine, switch context:
When you want to use local docker:
Using
skaffoldwith the remote docker:Unfortunately, skaffold won’t recognize the context docker is in, so you still will have to inform that in a environment variable.
Add
-H tcp://<your-remote-ip>to/usr/lib/systemd/system/docker.service, and useenv DOCKER_HOST=tcp://<your-remote-ip>:2375 skaffold build -v debuginstead ofskaffold build -v debug, it’s work to me.It seems to have something to do with this
Maybe need a PR
I believe I’m getting the same issue. Here’s the actual error:
Im getting this error with all combinations of
build.local.useBuildkitandbuild.local.useDockerCLI