missing-container-def

disallow a devcontainer.json that defines none of “image”, “build”, or “dockerComposeFile”

Category
correctness
Applies to
devcontainer
Platforms
all

Why

Every dev container is created from exactly one of “image”, “build”, or “dockerComposeFile”, and each of the three is required in its own scenario. A configuration that sets none of them describes no container at all, so no tool can create one from it.

Bad

{
  "name": "my project",
  "forwardPorts": [3000]
}

Good

{
  "name": "my project",
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
  "forwardPorts": [3000]
}

References