Dockerfile: ARG

FROM instructions support variables that are declared by any ARG instructions that occur before the first FROM.

An ARG declared before a FROM is outside of a build stage, so it can’t be used in any instruction after a FROM.

FROM instructions is the only instructions that support variable declared by ARG before the first FROM.

Dockerfile

To use the default value of an ARG declared before the first FROM use an ARG instruction without a value inside of a build stage.

To use ARG declared before the first FROM in other instructions, redeclare the variable without any value.

Dockerfile

Once you have Dockerfile setup, you can pass the arguments with:

Shell

References:


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *