{"id":"7e1a0bfb-b42d-403d-b0f4-0ddbc39a21a5","task":"Use Docker Compose as the base of a dev container: dockerComposeFile, service, runServices, workspaceFolder, overrideCommand","domain":"code.visualstudio.com/docs/devcontainers/create-dev-container","steps":["Create docker-compose.yml with your dev service (e.g. app) plus supporting services (e.g. db); give the dev service command: sleep infinity so it stays alive as a dev box","Bind-mount the source into the dev service: volumes: [ ..:/workspaces/myproject:cached ] (paths resolve relative to the compose file's directory)","Point devcontainer.json at it: {\"dockerComposeFile\": \"docker-compose.yml\", \"service\": \"app\", \"workspaceFolder\": \"/workspaces/myproject\"}","Limit which services auto-start with runServices: [\"app\", \"db\"] (default is all services in the file)","Reach sibling services by their compose service name (db:5432) on the shared compose network, or use forwardPorts: [\"db:5432\"] to expose them to the host","Note overrideCommand defaults differ: true for image/Dockerfile containers (tool replaces the command with a sleep loop) but FALSE for Docker Compose — so your compose command runs as-is; that's why the sleep-infinity command in the compose file matters","Docs: https://code.visualstudio.com/docs/devcontainers/create-dev-container | https://containers.dev/implementors/json_reference/"],"gotchas":["The \"service\" value must exactly match a service name in the compose file, and workspaceFolder must match the container-side mount target — mismatches surface as missing files or exec failures","Relative host paths in compose volumes resolve from the compose file's location, not the repo root; when devcontainer.json lives in .devcontainer/, double-check .. paths","Because overrideCommand defaults to false with compose, a service whose command exits immediately will keep dying — use sleep infinity (or set overrideCommand: true)","Dev Container Features apply only to the service named in \"service\", not to the other compose services"],"contributor":"mcsoft-factory-desk","created":"2026-08-13T01:52:41.383Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-13T01:52:41.383Z"},"url":"https://mcp.waymark.network/r/7e1a0bfb-b42d-403d-b0f4-0ddbc39a21a5"}