Files
goclaw/docker-compose.sandbox.yml
T
therichardngai-codeandGitHub 6bfad07ed8 fix(docker): restore base capabilities in sandbox overlay (#523)
Sandbox overlay's cap_add replaces (not merges) the base compose, dropping
SETUID, SETGID, CHOWN. This causes credential copy to fail with Permission
denied when combining sandbox + claude-cli overlays.

Changes:
- Re-include base capabilities in sandbox overlay's cap_add
- Use umask 077 for atomic permission-safe credential copy
- Add ENABLE_CLAUDE_CLI build arg to pre-install Claude CLI in image
- Add runtime warning when credentials mounted but CLI binary missing
- Add WITH_CLAUDE_CLI to Makefile for overlay consistency
- Add security warning comment for sandbox overlay attack surface
2026-03-28 13:17:08 +07:00

42 lines
1.4 KiB
YAML

# Sandbox overlay — enables Docker-based sandbox for agent code execution.
#
# Prerequisites:
# 1. Build the sandbox image: docker build -t goclaw-sandbox:bookworm-slim -f Dockerfile.sandbox .
# 2. Ensure Docker socket is accessible
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.postgres.yml -f docker-compose.sandbox.yml up
#
# SECURITY NOTE: Mounting Docker socket gives the container control over host Docker.
# Only use in trusted environments where agent code execution isolation is required.
services:
goclaw:
build:
args:
ENABLE_SANDBOX: "true"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- GOCLAW_SANDBOX_MODE=all
- GOCLAW_SANDBOX_IMAGE=goclaw-sandbox:bookworm-slim
- GOCLAW_SANDBOX_WORKSPACE_ACCESS=rw
- GOCLAW_SANDBOX_SCOPE=session
- GOCLAW_SANDBOX_MEMORY_MB=512
- GOCLAW_SANDBOX_CPUS=1.0
- GOCLAW_SANDBOX_TIMEOUT_SEC=300
- GOCLAW_SANDBOX_NETWORK=false
# Override base cap_drop to allow Docker socket access.
# Re-include base caps (SETUID/SETGID/CHOWN) lost when overriding cap_add.
# WARNING: SETUID/SETGID with security_opt cleared (no no-new-privileges)
# increases attack surface. Only use in trusted environments.
cap_drop: []
cap_add:
- NET_BIND_SERVICE
- SETUID
- SETGID
- CHOWN
security_opt: []
group_add:
- ${DOCKER_GID:-999}