The devcontainer spec doesn't specify whether the devcontainer runtime environment is supposed to launch a Docker Compose based devcontainer setup with:
docker compose up
OR
docker compose up <dev-container-name>
Specifically, it doesn't indicate which containers are going to start in a default case where no extra hints are given. Without extra hints, devcontainer runtime environments behave differently. GitHub codespaces and VSCode will effectively launch with docker compose up, starting all containers. IntelliJ will effectively launch with docker compose up <dev-container-name>, starting ONLY the dev container.
There are hints both in Docker Compose and in the dev container spec to explicitly override the devcontainer runtime default. In Docker Compose, if you start a specific container, but that container has depends_on configured in the compose.yaml, then the other containers are started to. In the devcontainer spec, you can indicate in your .devcontainer/devcontainer.json the specific set of containers that should start via the runServices field.
The use of runServices may be preferred in some cases as depends_on primarily is used to define startup-order.
See Also: devcontainers/spec#274
The devcontainer spec doesn't specify whether the devcontainer runtime environment is supposed to launch a Docker Compose based devcontainer setup with:
docker compose upOR
docker compose up <dev-container-name>Specifically, it doesn't indicate which containers are going to start in a default case where no extra hints are given. Without extra hints, devcontainer runtime environments behave differently. GitHub codespaces and VSCode will effectively launch with
docker compose up, starting all containers. IntelliJ will effectively launch withdocker compose up <dev-container-name>, starting ONLY the dev container.There are hints both in Docker Compose and in the dev container spec to explicitly override the devcontainer runtime default. In Docker Compose, if you start a specific container, but that container has depends_on configured in the compose.yaml, then the other containers are started to. In the devcontainer spec, you can indicate in your
.devcontainer/devcontainer.jsonthe specific set of containers that should start via therunServicesfield.The use of
runServicesmay be preferred in some cases as depends_on primarily is used to define startup-order.See Also: devcontainers/spec#274