missing-build-dockerfile

disallow a devcontainer.json “build” object that is missing “dockerfile”

Category
correctness
Applies to
devcontainer
Platforms
all

Why

“build.dockerfile” is the only required member of “build”: it locates, relative to the devcontainer.json, the Dockerfile the image is built from. The other members (“context”, “args”, “target”, …) only shape a build that “dockerfile” defines, so without it there is nothing to build.

Bad

{
  "name": "my project",
  "build": {
    "context": ".."
  }
}

Good

{
  "name": "my project",
  "build": {
    "dockerfile": "Dockerfile",
    "context": ".."
  }
}

References