Fix job containers unable to reach DinD daemon for direct docker commands
docker_host: "-" was disabling docker access in job containers entirely, so steps running `docker build`/`docker` directly had no daemon to talk to. Point docker_host at the dind sibling and add a host-gateway entry so the "dind" hostname resolves inside job containers, which run nested on dind's own internal bridge network rather than the outer compose one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XFsukF6FzwBxJtRGzbt28F
This commit is contained in:
+8
-2
@@ -32,12 +32,18 @@ container:
|
|||||||
# Talk to the DinD daemon, not the host.
|
# Talk to the DinD daemon, not the host.
|
||||||
network: ""
|
network: ""
|
||||||
privileged: false
|
privileged: false
|
||||||
options: ""
|
# Job containers run *inside* the dind engine, on its own internal bridge network,
|
||||||
|
# so the "dind" hostname (only known on the outer compose network) doesn't resolve
|
||||||
|
# there. host-gateway maps it to dind's own bridge-gateway IP, where its dockerd
|
||||||
|
# listens (started with --host=tcp://0.0.0.0:2375), so job steps can reach it.
|
||||||
|
options: "--add-host=dind:host-gateway"
|
||||||
workdir_parent: ""
|
workdir_parent: ""
|
||||||
# Allow workflows to mount caches from the DinD volume.
|
# Allow workflows to mount caches from the DinD volume.
|
||||||
valid_volumes:
|
valid_volumes:
|
||||||
- "**"
|
- "**"
|
||||||
docker_host: "-"
|
# Pass DOCKER_HOST into job/service containers so steps that call `docker` directly
|
||||||
|
# (e.g. `docker build`) can reach the DinD daemon. Paired with the --add-host above.
|
||||||
|
docker_host: "tcp://dind:2375"
|
||||||
force_pull: false
|
force_pull: false
|
||||||
|
|
||||||
host:
|
host:
|
||||||
|
|||||||
Reference in New Issue
Block a user