Skip to content

hadolint fails with DL1000 on variable expressions #1040

Open
@droopy4096

Description

@droopy4096
  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

Expected behavior

pass linting

Actual behavior

error:

[
  {
    "code": "DL1000",
    "column": 39,
    "file": "repo1/gitlab-base/Dockerfile",
    "level": "error",
    "line": 40,
    "message": "unexpected ':'\nexpecting '@', '\\', a new line followed by the next instruction, or the image tag"
  }
]

Steps to reproduce the behavior

use variable expression in a Dockerfile:

# hadolint ignore=DL1000
FROM ${BASE_REGISTRY:-}${BASE_REGISTRY:+/}${BASE_IMAGE}:${BASE_TAG} 

most basic would be:

Output of hadolint --version or
docker run --rm hadolint/hadolint hadolint --version or
docker run --rm ghcr.io/hadolint/hadolint hadolint --version:

$ hadolint --version
Haskell Dockerfile Linter 2.12.0

Dockerfile (if relevant)

ARG BASE_REGISTRY=
ARG BASE_IMAGE=alpine
ARG BASE_TAG=latest

FROM ${BASE_REGISTRY:-}${BASE_REGISTRY:+/}${BASE_IMAGE}:${BASE_TAG} 

Additional environment details (OS, stack version, etc.)

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