I have a certain setting of Python in an docker image named deep
. I used to run python code
docker run --rm -it -v \"$PWD\":/app -w /app deep python
Interestingly, I found quite nice and thorough solutions in ROS community. http://wiki.ros.org/docker/Tutorials/GUI
For my problem, my final choice is the second way in the tutorial:
docker run --rm -it \
--user=$(id -u) \
--env="DISPLAY" \
--workdir=/app \
--volume="$PWD":/app \
--volume="/etc/group:/etc/group:ro" \
--volume="/etc/passwd:/etc/passwd:ro" \
--volume="/etc/shadow:/etc/shadow:ro" \
--volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
deepaul python test.python