O'Reilly logo

Docker and Kubernetes for Java Developers by Jaroslaw Krochmalski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ARG

The ARG instruction is being used to pass an argument to the Docker daemon during the docker build command. An ARG variable definition comes into effect from the line on which it is defined in the Dockerfile. By using the --build-arg switch, you can assign a value to the defined variable:

$ docker build --build-arg <variable name>=<value> .

The value from the --build-arg will be passed to the daemon building the image. You can specify multiple arguments using multiple ARG instructions. If you specify a build time argument that is not defined using ARG, the build will fail with an error, but the default value can be specified in the Dockerfile . You specify the default argument value this way:

FROM ubuntuARG user=jarek

If no argument will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required