Skip to content

Allow new field option 'env' when mounting Secrets inside RUN commands #1039

@yannispgs

Description

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

Dockerfile Syntax 1.10.0 has been released, allowing secrets to be mounted as environment variables (+ file) rather than as a file.
Instead of target=<path> we can use env=<env_var_name>.

As it is brand new, the current rules do not allow this new field and raise an error.

Expected behavior

No error raised at all

Actual behavior

hadolint Dockerfile

Dockerfile.test:6:36 unexpected "env=ENV_VAR ec" expecting "gid=", "id=", "mode=", "required", "required=False", "required=True", "required=false", "required=true", "uid=", source=, or target=

Steps to reproduce the behavior

Output of hadolint --version

Haskell Dockerfile Linter 2.12.0

Dockerfile

# syntax=docker/dockerfile:1.10

FROM node:20

RUN --mount=type=secret,id=ENV_VAR,env=ENV_VAR echo "ENV_VAR=$ENV_VAR" > /tmp/env_var

Command run = docker build . --secret 'id=ENV_VAR,env=ENV_VAR'

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