Skip to content

[awf] Docker Manager: Workflow-wide DinD configuration (DOCKER_HOST) breaks AWF container startup #1930

@lpcox

Description

@lpcox

Problem

When a workflow enables Docker-in-Docker (DinD) at the workflow scope (via services: dind: + DOCKER_HOST: tcp://localhost:2375), the compiled gh aw workflow fails during AWF startup with:

[INFO] Set DOCKER_API_VERSION=1.54 (server current)
Error:  Port 80 is not exposed from the container
Error:  Add port mapping: -p <host_port>:80

Agentic workflows that need to build or run Docker images as part of their task cannot use this pattern.

Context

Root Cause

When DOCKER_HOST is set to a remote TCP socket (DinD daemon), the AWF docker compose commands are routed to the DinD daemon instead of the local Docker socket. The DinD daemon does not have the host port bindings that AWF relies on for the Squid proxy (ports: ["3128:3128"] in the compose config). The DinD daemon interprets "expose port" as requiring a host-level port mapping that doesn't exist in the DinD network context, causing the startup failure.

The root issue is in src/docker-manager.ts: AWF unconditionally uses DOCKER_HOST from the environment when spawning docker compose commands via execa. When DOCKER_HOST points to a DinD TCP socket, the host-side filesystem bind mounts also fail because the DinD daemon cannot access the runner host's filesystem.

Proposed Solution

  1. src/docker-manager.tsgetDockerComposeEnv() or similar helper: When DOCKER_HOST is set to a TCP address (DinD), spawn docker compose with DOCKER_HOST explicitly unset (using the local socket instead), so AWF always manages its own containers via the local daemon. Add a --docker-host CLI flag to allow explicit override.

  2. src/cli.ts: Add a warning when DOCKER_HOST is detected in the environment, informing the user that AWF manages its own containers via the local socket, and that the DinD daemon remains available inside the agent container (agent inherits the Docker socket mount).

  3. Agent container: Ensure the DinD DOCKER_HOST value is still forwarded into the agent container's environment (via env passthrough), so the agent's workload can use DinD as intended — only the AWF orchestration layer should use the local socket.

  4. Docs: Add a section in docs/environment.md explaining the DinD interaction model.

Generated by Firewall Issue Dispatcher · ● 1.6M ·

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions