I’m doing this:
RUN export FOO=hello
RUN env
The second RUN
doesn’t see the FOO
environment variable. Is it a limitation of Docker?
If it is, how do I set PATH
in one RUN
and make it available in another RUN
?
I’m doing this:
RUN export FOO=hello
RUN env
The second RUN
doesn’t see the FOO
environment variable. Is it a limitation of Docker?
If it is, how do I set PATH
in one RUN
and make it available in another RUN
?
2
Answers
The docker RUN command initializes its own shell when called in a new line. There is no connection between the two RUN commands.
Bash commands, however, can be combined in a single RUN statement.
Why not use Dockerfile’s
ENV
instruction for this purpose?