Reputation: 319
I have this line in a Dockerfile
RUN /bin/bash -c ". setup.sh ; echo $LD_LIBRARY_PATH ; make"
LD_LIBRARY_PATH
is set in setup.sh. However, when I run docker build .
the echo instruction just prints an empty string, and make
gives an error for a library not found.
From many answers found here in Stackoverflow and elsewhere, I would expect the path to be printed out.
What am I missing? Thanks in advance
Upvotes: 0
Views: 929
Reputation: 264701
In a Dockerfile, the line:
RUN /bin/bash -c ". setup.sh ; echo $LD_LIBRARY_PATH ; make"
will result in the $LD_LIBRARY_PATH
variable being expanded by docker itself (you can set that variable with an ARG
or ENV
line). To get the variable to be expanded by the shell inside your container, simply escape it with a backslash:
RUN /bin/bash -c ". setup.sh ; echo \$LD_LIBRARY_PATH ; make"
Upvotes: 1