docker ENV vs RUN export

http://stackoverflow.com/questions/33379393/docker-env-vs-run-export

As illustrated by issue 684, export won’t persist across images. (Don’t forget that each Dockerfile directive will generate an intermediate container, committed into an intermediate image: that image won’t preserve the exported value) ENV will:

The environment variables set using ENV will persist when a container is run from the resulting image.You can view the values using docker inspect, and change them using docker run —env =.
The issue was illustrating that with:

RUN export PATH=$PATH:/foo/bar # from directly in builder

# Docker 

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×