Dockerfile - set ENV to result of command

后端 未结 6 1239
傲寒
傲寒 2020-12-02 15:17

Is it possible to set a docker ENV variable to the result of a command? Like:

ENV MY_VAR whoami

i want MY_VAR to get the value \"root\" or

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 15:45

    At this time, a command result can be used with RUN export, but cannot be assigned to an ENV variable.

    Known issue: https://github.com/docker/docker/issues/29110

提交回复
热议问题