Reference:
https://github.com/LeoCHANGcn/Nvidia-docker-Ubuntu-16.04-Unity-Desktop-TensorFlow-with-GPU https://github.com/chenjr0719/Docker-Ubuntu-MATE-noVNC
CUDA 10.1
cudnn 7
Python 3.6
Docker in docker
Terminator
Firefox browser
First, your computer should have at least one Nvidia video card with compute capability greater than or equal to 3.5 and installed proper driver (higher than 384.81 version) for it.
Second, you need to install Nvidia-docker following the instructions on this web page: Nvidia Docker
After installing Nvidia-docker, you can build this Dockerfile:
sudo nvidia-docker build -t linhle2708/nvidia-docker-ubuntu18.04-desktop:latest .
Or, just pull my image:
sudo docker pull linhle2708/nvidia-docker-ubuntu18.04-desktop:latest
The default usage of this image is:
sudo nvidia-docker run -itd -p 16069:6080 -v /var/run/docker.sock:/var/run/docker.sock -v /dev/shm:/dev/shm -e PASSWORD=ubuntu -e SUDO=yes --shm-size=20G --privileged linhle2708/nvidia-docker-ubuntu18.04-desktop:latest
Tips:
"-e PASSWORD =ubuntu" aims to set a password as "ubuntu" for you.
(This password is for noVNC login and system login.)
"-e SUDO=yes" aims to let you login as a user with root permission. (Recommended)
If you don't set "-e PASSWORD=$your_password" option, the password will create randomly, to find it, please use the following command:
sudo docker exec $CONTAINER_ID cat /home/ubuntu/password.txtAnd if you don't set "-e SUDO=yes" option, you cannot use "sudo" command in the system.
You can change your system login password by using:
passwd
And input new password following the hints. (New password should be at least 8 numbers or letters).
Note: You can just change the system login password, but can't change the noVNC login password.
Ngrok can be used to deploy local host to the Internet.
If you need to use this image across the Internet, Ngrok is what you need.
To enable Ngrok, use following command:
sudo docker run -itd -p 80:6080 -e NGROK=yes leeochang/deep_learning:v0.1
And find the link address:
sudo docker exec $CONTAINER_ID cat /home/ubuntu/ngrok/Ngrok_URL.txt
NGROK=YES, NGROK=Yes, NGROK=Y, NGROK=y are also supported.
Caution!! this may also cause security issues, use it carefully.
gnome‐screensaver‐command ‐l
If you want to use Anaconda to manage your python environment, first install Anaconda and create a virtual environment, for example "conda create -n tf35 python=3.5". Then you should copy "/usr/local/lib/python3.5/dist-packages/cv2.so" and "/usr/local/lib/python3.5/dist-packages/cv2.cpython-35m-x86_64-linux-gnu.so" to "$your_Anaconda_path/env/tf35/lib/python3.5/site-packages" directory. And you cannot use OpenCV this way for python version higher than 3.5 but only lower or equal to 3.5.
If you use jupyer, you should use "jupyter notebook --ip=0.0.0.0" to start the notebook. And if you use jupyter notebook, I suggest that you map the port 8888 out to your host and access jupyter notebook by your local host browser for the Firefox browser in the container often crashes.
Need to expose port 22 of the container.
Use "scp" command if your system is os X or Linux.
Use MobaXterm for windows user.
Some components of Unity may not work properly with vncserver.
Sometimes you meet tab crash problem with Firefox:
To fix that, you need to input "about:preferences" in the address bar and press enter, and cancel the tick of the following options:
And input "about:config" in the address bar, double click to modify the following options:
- browser.tabs.remote.autostart = false
- browser.tabs.remote.autostart.2 = false (Optional)
- webgl.disable-wgl = true
- webgl.disabled = true
- webgl.enable-webgl2 = false
Finally, restart Firefox, hope solve the crash problem!