Skip to content

Expand Dockerfile directives in devcontainer with environment variables and build args when detecting user, image, etc. #344

@mafredri

Description

@mafredri

While working on #343 I noticed that the devcontainer package doesn't parse Dockerfiles such that environment variables or build args are expanded. This means that user/image detection won't be possible in all situations.

For instance, the following:

FROM ubuntu
ARG myuser=1000:1000
USER ${myuser}

Would result in the user being interpreted as the literal string ${myuser}.

I haven't looked into it, but maybe we can utilize the Expand method on the instructions: https://github.com/moby/buildkit/blob/3d8779b9dd07262f927224ef4e828068bb97e3fd/frontend/dockerfile/instructions/commands.go#L415

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions