How do I run exec on a remote docker host #6509
|
I can do something like this: DOCKER_HOST=ssh://10.10.10.10 docker container run --rm busybox ls
bin
dev
[...]I'd like to do something like this: steps:
- name: test
image: busybox
commands:
- lsThis works: woodpecker exec
[test:L0:0s] + ls
[test:L1:0s] testThis does not: woodpecker exec --backend-docker-host ssh://10.10.10.10 --backend-engine docker
12:04AM FTL error running cli error="Error reading remote info: EOF"Is using a remote Docker host possible with |
Replies: 2 comments 1 reply
|
we use the same internal lib (moby) as docker cli to connect to the docker daemon, so supporting |
|
When you run Workaround 1: SSH tunnel + TCP Set up a local port forward to the remote Docker socket: ssh -fNL /tmp/remote-docker.sock:/var/run/docker.sock user@10.10.10.10
DOCKER_HOST=unix:///tmp/remote-docker.sock woodpecker execWorkaround 2: Expose Docker over TCP on the remote host On the remote host, configure dockerd to listen on TCP (only do this on a trusted network): # /etc/docker/daemon.json
{"hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2376"]}Then: woodpecker exec --backend-docker-host tcp://10.10.10.10:2376 --backend-engine dockerWorkaround 3: Use a Woodpecker agent instead of exec If this is for actual CI (not just local testing), run a Woodpecker agent on the remote machine. |
woodpecker execwith--backend-docker-host ssh://...isn't supported. Theexeccommand uses the Docker client SDK which handles SSH hosts differently than the plaindockerCLI.When you run
docker -H ssh://10.10.10.10 ..., the Docker CLI sets up an SSH tunnel internally and forwards the Docker socket. Butwoodpecker execcreates a Docker client programmatically via the Go SDK, and the SSH dialer in the SDK expects the remote Docker daemon to be properly configured — theEOFerror means the SSH connection succeeds but the Docker API handshake fails (likely because the remote Docker socket isn't at the default path, or the SSH user can't access it).Workaround 1: SSH tunnel + TCP
Set up a l…