# Docker with GUI output ###### tags: `Docker` `Python` ## environment HW system: lenovo legion-y530-15ich (i7-8750h, 8G RAM, NVIDIA-GEFORCE-GTX-1050) OS: Ubuntu Desktop 20.04.2 LTS, kernel 5.8.0-48 Docker version: 20.10.5 Docker image: nvcr.io/nvidia/tensorflow:21.02-tf1-py3 ## SOP ### host ```javascript= $ sudo apt-get install x11-xserver-utils //install x11 application $ xhost + //let everyone can use x11 application, including docker //we have to type "xhost +" command after booting everytime ``` ```javascript= /* added these parameters when you create container: -v /tmp/.X11-unix:/tmp/.X11-unix => share host unix graphical output to docker -e DISPLAY=unix$DISPLAY => change environment about graphic output of docker to let it same as host -e GDK_SCALE => i haven't studied it -e GDK_DPI_SCALE => i haven't studied it */ $ docker run --gpus=all -it --name x11_tf -v /home/yhwu/docker_volume:/volume -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -e GDK_SCALE -e GDK_DPI_SCALE -w /volume nvcr.io/nvidia/tensorflow:21.02-tf1-py3 //for example /* to split command: docker run --gpus=all -it --name x11_tf -v /home/yhwu/docker_volume:/volume -v /tmp/.X11-unix:/tmp/.X11-unix => added this -e DISPLAY=unix$DISPLAY => added this -e GDK_SCALE => added this -e GDK_DPI_SCALE => added this -w /volume nvcr.io/nvidia/tensorflow:21.02-tf1-py3 */ ``` ### in container ```javascript= $ apt update $ apt-get dist-upgrade $ apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev python-tk python3-tk tk-dev ``` ## source 1. https://blog.csdn.net/sirobot/article/details/106836332 2. https://askubuntu.com/questions/1224230/how-to-install-tkinter-for-python-3-8 3. https://ngc.nvidia.com/catalog/containers/nvidia:tensorflow
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up