How to define a variable in a Dockerfile?

后端 未结 6 1193
情歌与酒
情歌与酒 2020-12-07 16:02

In my Dockerfile, I would like to define variables that I can use later in the Dockerfile.

I am aware of the

6条回答
  •  再見小時候
    2020-12-07 16:42

    You can use ARG - see https://docs.docker.com/engine/reference/builder/#arg

    The ARG instruction defines a variable that users can pass at build-time to the builder with the docker build command using the --build-arg = flag. If a user specifies a build argument that was not defined in the Dockerfile, the build outputs an error.

提交回复
热议问题