Based on information available in the Docker documentation I created a Docker compose file for Docker Gateway that works together with Claude Code running in the container.
name: Test
networks:
development:
name: development
driver: bridge
services:
traefik:
container_name: traefik
isolation: default
image: traefik:v3.3.0-rc2
command:
- "--log.level=DEBUG"
- "--accesslog=true"
- "--api"
- "--api.debug=true"
- "--api.dashboard=true"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.file.directory=/etc/traefik"
- "--entryPoints.web.address=:80"
- "--entryPoints.web.http.redirections.entryPoint.to=websecure"
- "--entryPoints.websecure.address=:443"
- "--entryPoints.websecure.proxyProtocol.insecure=true"
- "--entryPoints.sqlserver.address=:1433"
- "--entryPoints.sqlserver.proxyProtocol.insecure=true"
ports:
- "80:80"
- "443:443"
- "1433:1433"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik/config/dynamic/dynamic.yaml:/etc/traefik/dynamic.yaml:ro
- ./certs:/etc/certs:ro
networks:
- development
healthcheck:
test: ["CMD", "traefik", "healthcheck", "--ping"]
extra_hosts:
- "host.docker.internal:host-gateway"
claude:
container_name: claude
isolation: default
build:
dockerfile: .Dockerfile
context: ./build/claude
args:
TZ: "America/Los_Angeles"
CLAUDE_CODE_VERSION: "latest"
GIT_DELTA_VERSION: "0.18.2"
ZSH_IN_DOCKER_VERSION: "1.2.0"
cap_add:
- NET_ADMIN
- NET_RAW
user: node
volumes:
- ./data/claude/delegated:/delegated
- ./data/claude/claude-code-bashhistory:/commandhistory
- ./data/claude/claude-code-config:/home/node/.claude
- ./data/claude/claude-root:/root/.claude
environment:
NODE_OPTIONS: "--max-old-space-size=4096"
CLAUDE_CONFIG_DIR: "/home/node/.claude"
POWERLEVEL9K_DISABLE_GITSTATUS: "true"
MCP_HOST: http://mcp-gateway:8811/sse
stdin_open: true
tty: true
restart: always
networks:
- development
depends_on:
- mcp-gateway
extra_hosts:
- "host.docker.internal:host-gateway"
mcp-gateway:
image: docker/mcp-gateway:latest
ports:
- 8811:8811
use_api_socket: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command:
- --transport=sse
- --port=8811
- --servers=fetch,brave,curl,context7,playwright
- --config=/mcp_config
- --secrets=docker-desktop:/run/secrets/mcp_secret
- --verbose
configs:
- mcp_config
secrets:
- mcp_secret
networks:
- development
extra_hosts:
- "host.docker.internal:host-gateway"
configs:
mcp_config:
content: |
servers:
fetch:
ignore_robots_txt: true
networks:
- development
extra_hosts:
- "host.docker.internal:host-gateway"
brave:
networks:
- development
extra_hosts:
- "host.docker.internal:host-gateway"
curl:
networks:
- development
extra_hosts:
- "host.docker.internal:host-gateway"
context7:
networks:
- development
extra_hosts:
- "host.docker.internal:host-gateway"
playwright:
networks:
- development
extra_hosts:
- "host.docker.internal:host-gateway"
secrets:
mcp_secret:
file: ./data/mcp-gateway/mcp.env
I am trying to inject some configuration into the containers created by Docker MCP Gateway with MCP servers like one for Fetch MCP Server. No matter what I try it seems that configuration is kind of ignored.
Containers are created, Claude connects to MCPs too. Any suggestions?