feat(cli): add --enable-dind flag to opt-in to Docker socket access#1276
feat(cli): add --enable-dind flag to opt-in to Docker socket access#1276
Conversation
Add --enable-dind flag that exposes the host Docker socket to the agent container, enabling Docker-in-Docker workflows. By default, the socket remains hidden (mounted as /dev/null) for security. Closes #116 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
Adds an opt-in CLI/config switch to allow Docker-in-Docker style workflows by exposing the host Docker socket to the agent container, while keeping the default behavior secure (socket hidden via /dev/null).
Changes:
- Extend
WrapperConfigwithenableDind?: boolean. - Update Docker Compose generation to either hide or expose the host Docker socket based on
enableDind. - Add CLI flag
--enable-dindand unit tests covering default/opt-in behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/types.ts |
Adds enableDind config field with security warning docs. |
src/docker-manager.ts |
Gates Docker socket volume mounts on config.enableDind. |
src/docker-manager.test.ts |
Adds unit coverage for default hide vs opt-in expose behavior. |
src/cli.ts |
Adds --enable-dind flag and wires it into WrapperConfig. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * When true, the host's Docker socket (/var/run/docker.sock) is mounted | ||
| * into the agent container, allowing the agent to run Docker commands. | ||
| * | ||
| * WARNING: This allows the agent to bypass firewall restrictions by | ||
| * spawning new containers without network restrictions. | ||
| * | ||
| * @default false | ||
| */ |
| agentVolumes.push(`${dockerSocketPath}:/host${dockerSocketPath}:rw`); | ||
| // Also expose the /run/docker.sock symlink if it exists | ||
| agentVolumes.push('/run/docker.sock:/host/run/docker.sock:rw'); |
| it('should expose Docker socket when enableDind is true', () => { | ||
| const dindConfig = { ...mockConfig, enableDind: true }; | ||
| const result = generateDockerCompose(dindConfig, mockNetworkConfig); | ||
| const agent = result.services.agent; | ||
| const volumes = agent.volumes as string[]; | ||
|
|
||
| // Docker socket should be mounted read-write, not hidden | ||
| expect(volumes).toContain('/var/run/docker.sock:/host/var/run/docker.sock:rw'); | ||
| expect(volumes).toContain('/run/docker.sock:/host/run/docker.sock:rw'); | ||
| // Should NOT have /dev/null mounts | ||
| expect(volumes).not.toContain('/dev/null:/host/var/run/docker.sock:ro'); | ||
| expect(volumes).not.toContain('/dev/null:/host/run/docker.sock:ro'); | ||
| }); |
Smoke Test Results — PASS ✅
Overall: PASS —
|
Smoke Test Results
Overall: PASS
|
Chroot Version Comparison Results
Result: FAILED — Python and Node.js versions differ between host and chroot environments.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Summary
--enable-dindCLI flag that exposes the host Docker socket to the agent container/dev/null) for security/var/run/docker.sockand/run/docker.sockas read-write into the chrootFixes #116
Test plan
should hide Docker socket by default)enableDind: true(should expose Docker socket when enableDind is true)🤖 Generated with Claude Code