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