How to define a variable in a Dockerfile?

后端 未结 6 1194
情歌与酒
情歌与酒 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:46

    To answer your question:

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

    You can define a variable with:

    ARG myvalue=3
    

    Spaces around the equal character are not allowed.

    And use it later with:

    RUN echo $myvalue > /test
    

提交回复
热议问题