{
  "schemaVersion": "ebb.rule.v1",
  "id": "container.dockerfile.legacy-env-format",
  "ecosystem": "container",
  "purl": "pkg:generic/dockerfile",
  "affectedVersions": "vers:semver/*",
  "event": "deprecated",
  "severity": "low",
  "title": "The Dockerfile legacy \"ENV key value\" form is deprecated",
  "summary": "Docker's LegacyKeyValueFormat build check flags the space-separated ENV form and recommends writing each assignment as key=value.",
  "replacement": "The ENV key=value form, with the value quoted when it contains spaces",
  "sources": [
    {
      "title": "Docker build check: LegacyKeyValueFormat",
      "url": "https://docs.docker.com/reference/build-checks/legacy-key-value-format/",
      "accessedAt": "2026-10-31"
    },
    {
      "title": "Dockerfile reference: ENV",
      "url": "https://docs.docker.com/reference/dockerfile/#env",
      "accessedAt": "2026-10-31"
    }
  ],
  "provenance": {
    "observedAt": "2026-10-31",
    "reviewedAt": "2026-10-31",
    "reviewer": "arminazimi"
  },
  "migration": {
    "constraints": [
      "Keep the variable name and its value unchanged.",
      "Use one key=value assignment per variable."
    ],
    "steps": [
      {
        "id": "quote-legacy-env",
        "title": "Write the variable as key=value",
        "instructions": "Replace ENV key value with ENV key=\"value\", quoting the value when it contains spaces.",
        "targets": "declaration"
      }
    ],
    "verification": [
      {
        "command": "docker build .",
        "purpose": "Build the image with the rewritten Dockerfile."
      },
      {
        "command": "docker run --rm IMAGE env",
        "purpose": "Confirm the variable keeps its name and value."
      }
    ]
  }
}
