missing-compose-service

disallow a devcontainer.json that sets “dockerComposeFile” without “service”

Category
correctness
Applies to
devcontainer
Platforms
all

Why

A Compose project usually defines several services, so naming the Compose file does not say which container the tooling should attach to. The specification requires “service” to name that main container: it is the one lifecycle scripts run in and the one editors connect to.

Bad

{
  "name": "my project",
  "dockerComposeFile": "docker-compose.yml",
  "workspaceFolder": "/workspace"
}

Good

{
  "name": "my project",
  "dockerComposeFile": "docker-compose.yml",
  "service": "app",
  "workspaceFolder": "/workspace"
}

References