How to unset “ENV” in dockerfile?

后端 未结 5 440
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-07 22:03

For some certain reasons, I have to set \"http_proxy\" and \"https_proxy\" ENV in my dockerfile. I would like to now unset them because there are also some buil

5条回答
  •  遥遥无期
    2021-01-07 22:45

    According to docker docs you need to use shell command instead:

    FROM alpine
    RUN export ADMIN_USER="mark" \
    && echo $ADMIN_USER > ./mark \
    && unset ADMIN_USER
    CMD sh
    

    See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#env for more details.

提交回复
热议问题