I have a Dockerfile:
### everything, that was commented out with '#' was tried to no avail
FROM ubuntu
#RUN echo "!#/bin/sh" > do.sh
RUN echo "export A=A" >> do.sh
### please run script do.sh
#SHELL ["/bin/bash" ,"-c", "source /do.sh"]
#RUN source /do.sh
#ENTRYPOINT /do.sh
And I build it with a Makefile:
all: build run
build:
echo build|figlet
docker build -t test .
run:
echo run|figlet
docker run -it test
I just want to have the environment variable from the script do.sh when I enter the interactive terminal.
This is a recreation of a problem from another context. That is why I do not want to make the script executable. My original context is: I want to call a script in catkin_ws/devel . ~/catkin_ws/devel/setup.bash
. ~/catkin_ws/devel/setup.bash
from this tutorial http://wiki.ros.org/ROS/Tutorials/CreatingPackage .
Try "--env-file=" option with docker run
RUN echo "export A=A" >> ~/.bash_profile
all: build run
build:
echo build|figlet
docker build -t test .
run:
echo run|figlet
docker run -it test /bin/bash -l
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.