Docker echo environment variable

前端 未结 3 1289
刺人心
刺人心 2021-02-19 13:56

I\'m trying to write a little docker file that sets a User and just echos the current user as a little example to prove to myself it is working. I\'ve tried a number of variants

3条回答
  •  花落未央
    2021-02-19 14:27

    I think there´s a series of issues here.

    when I

    docker run -i -t ubuntu /bin/bash
    echo $USER
    set
    

    I don´t see $USER set at all - whoami does report daemon though.

    additionally, I have the suspicion (but have not looked at the code yet) that ENV vars in the Dockerfile are escaped, to avoid their use (many people assume that they can export host variables to the built container, but this is something that the docker guys would like to avoid)

提交回复
热议问题