Skip to content

devcontainer spec isn't clear on use of compose #6

@slominskir

Description

@slominskir

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions