Repository navigation
Description
Problem
When Docker-in-Docker is enabled at workflow scope (i.e., DOCKER_HOST=tcp://localhost:2375 set as a workflow env var alongside a dind service container), AWF-compiled workflows fail at 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
This makes agentic workflows that need to build or run Docker images non-functional without manual workarounds.
Context
Original github/gh-aw issue: github/gh-aw#25511
Repro: add the following to a compiled workflow:
services:
dind:
image: docker:dind
options: --privileged
ports:
- 2375:2375
env:
DOCKER_TLS_CERTDIR: ""
env:
DOCKER_HOST: tcp://localhost:2375
network:
allowed:
- defaults
- containersA comment on the upstream issue notes: "we need to document why it is disabled" — indicating this is a known limitation that currently lacks documentation.
Root Cause
When DOCKER_HOST is set to an external TCP daemon (DinD sidecar), docker compose routes all container creation through that daemon. AWF's containers run inside the DinD daemon's network namespace, which:
- Cannot resolve AWF's fixed subnet
172.30.0.0/24from the GitHub Actions runner host - Does not bind port 80 in a way the DinD daemon expects (AWF uses internal-only networking, no host port bindings)
- The iptables DNAT rules set up by
awf-iptables-initoperate in the DinD network namespace, not the host runner's namespace
Relevant code: src/docker-manager.ts generates the docker-compose.yml with network_mode: awf-net and a fixed subnet. When DOCKER_HOST is set, execa('docker', ['compose', ...]) inherits the env var and sends compose commands to the wrong daemon.
Proposed Solution
-
Detect and fail fast in
src/cli.ts: On startup, check ifDOCKER_HOSTis set and points to a non-default socket (i.e., notunix:///var/run/docker.sock). If so, emit a clear error:[ERROR] DOCKER_HOST is set to an external daemon (tcp://...). AWF requires the local Docker daemon (default socket). Workflow-scope DinD is incompatible with AWF's network isolation model. -
Document the limitation in
README.mdunder a "Limitations" or "DinD Compatibility" section: explain that AWF manages its own Docker network (172.30.0.0/24) and iptables rules that require direct access to the host's Docker socket. Workflow-scope DinD breaks this because AWF's containers would run inside the DinD daemon's network namespace, making the subnet routing and iptables DNAT unreachable from the runner. -
Provide a workaround: Users who need DinD inside the agent command should use AWF's
--enable-docker-socketflag to pass the host Docker socket into the agent container, rather than configuring DinD at workflow scope.
Generated by Firewall Issue Dispatcher · ● 1.4M · ◷
Activity