Skip to content

Arguments not specified at the top of the Dockerfile are ignored #150

@BorekZnovustvoritel

Description

@BorekZnovustvoritel

How to reproduce

Suppose we have a file called Dockerfile:

ARG foo
FROM $foo

If we run the command dockerfile-json --build-arg=foo=alpine Dockerfile, the tool correctly interprets that the base image to use is alpine.

However when we change the contents slightly:

FROM ubuntu
# ...
ARG foo
FROM $foo

then the tool will interpret the last step as {... "From": {"Image": ""}, ...} even with the passed --build-arg, which breaks base image parsing.

Expected behavior

The argument foo should be interpreted in the same way in both of these cases. I know this can be worked around by modifying the Dockerfile (pushing all ARGs to the top of the Dockerfile), but both of these formats are valid and only one of them is supported by dockerfile-json.

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