Install Docker
https://gist.github.com/nathzi1505/d2aab27ff93a3a9d82dada1336c45041
# WARNING : This gist in the current form is a collection of command examples. Please exercise caution where mentioned.
# Docker
sudo apt-get update
sudo apt-get remove docker docker-engine docker.io
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
docker --version
# Put the user in the docker group
sudo usermod -a -G docker $USER
newgrp docker
# Nvidia Docker
sudo apt install curl
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
# Check Docker image
docker run --gpus all nvidia/cuda:10.0-base nvidia-smi
## Erase all Docker images [!!! CAUTION !!!]
# docker rmi -f $(docker images -a -q)
## Erase one Docker image [!!! CAUTION !!!]
# docker ps
# docker rmi -f image_id
## Running GUI Applications
xhost +local:docker
docker run --gpus all -it \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
nathzi1505:darknet bash
NVIDIA Docker Image List
Nvidia CUDA docker labels:
https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda/tags
Useful Command
# Docker IDE
docker pull portainer/portainer
docker volume create portainer_data
docker run -d -p 9000:9000 --restart=always --name portainer -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
# GUI to outside
sudo nvidia-docker run --rm -ti --ipc=host --volume=$HOME/.Xauthority:/root/.Xauthority:rw --net=host --env=DISPLAY --name Liwen_Demo -v ~/Demo_Liwen:/Demo_Liwen demo_liwen_v1
# save image
docker commit [container] mymysql:v1
docker save [image] > busybox.tar
docker load < busybox.tar