-
Notifications
You must be signed in to change notification settings - Fork 377
Description
Question / Clarification Request
I have a devcontainer setup using Docker Compose with the docker-outside-of-docker feature. My devcontainer.json is as follows:
{
"name": "hanhanmap-frontend",
"dockerComposeFile": "compose.yaml",
"service": "hanhanmap-frontend",
"workspaceFolder": "/workspace/frontend",
"onCreateCommand": "docker compose -f .devcontainer/compose.yaml run --rm code-sync",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker": {}
}
}The dev container is based on Docker Compose, with no bind mounts — only a named volume:
services:
hanhanmap-frontend:
build:
context: .
dockerfile: Dockerfile
volumes:
- volume-of-hanhan:/workspace
working_dir: /workspace/frontend
command: sleep infinity
volumes:
volume-of-hanhan:The onCreateCommand runs successfully — docker compose -f .devcontainer/compose.yaml run --rm code-sync completes without errors.
However, this raises a question I cannot answer with confidence:
The path .devcontainer/compose.yaml is passed to docker compose -f. Since the docker CLI inside the container communicates with the host's Docker daemon via the socket (DooD), and since .devcontever/compose.yaml does not exist inside the container (no bind mount), how is this path resolved?
Possible explanations:
- The
docker compose -f <path>resolves the path in the host's filesystem context, not the container's — because the command is ultimately dispatched to the host daemon. - The Dev Containers CLI somehow makes
.devcontainer/available inside the container beforeonCreateCommandruns. - Something else entirely.
What I'd like to understand:
- What is the working directory and filesystem context when
onCreateCommandruns adocker composecommand via DooD? - Is this behavior defined in the Dev Container spec, or is it an implementation detail of the VS Code Dev Containers extension?
- Can I rely on host-side paths being resolvable from within
onCreateCommandwhen using DooD?
Thank you!