==cheatsheet==
https://www.docker.com/sites/default/files/d8/2019-09/docker-cheat-sheet.pdf

==docker install==

 apt install docker.io

==docker export & save==

<code>export</code> will fetch the whole container

e.g.
 docker import calc-container.tar calcfs:latest

==docker run & start==
 docker run -dit repo:tag
 docker start image_id

 docker exec -it container_id /bin/bash

example:

 docker run -d --name=MYPROJECT_oracle_db --shm-size=2g -p 1521:1521 -p 8080:8080 alexeiled/docker-oracle-xe-11g



==docker TZ==
 docker run -e TZ=Aisa/Shanghai debian:jessie date
or 
 ENV TZ=Aisa/Shanghai


==docker image, container, Dockerfile==

 docker ps -a

 docker container ls

==docker auto start==
https://docs.docker.com/engine/reference/run/#restart-policies-restart

 docker run --restart=always

==docker cleaning==
https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes#removing-containers

 docker system prune -a

 docker rm <CONTAINER ID>

 docker rmi <image>



==docker DNS problem==
edit in config
 /etc/docker/daemon.json

add:
 { "dns": ["10.0.0.2", "8.8.8.8"] }


ref: https://development.robinwinslow.uk/2016/06/23/fix-docker-networking-dns/


==run arm on x86==

https://ownyourbits.com/2018/06/27/running-and-building-arm-docker-containers-in-x86/

<code>qemu-aarch64-static  qemu-arm-static</code>

==misc==
 ENV DEBIAN_FRONTEND=noninteractive


==nvidia docker==

https://docs.docker.com/install/linux/docker-ce/debian/

===nv driver install===
Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
 blacklist nouveau
 options nouveau modeset=0
Regenerate the kernel initramfs:
 $ sudo update-initramfs -u

 apt-get install linux-headers-$(uname -r)
OR proxmox add apt source:
 	
 deb http://download.proxmox.com/debian stretch pve-no-subscription
 apt install pve-headers
and install run file

===docker===
root run:

 apt-get install -y apt-transport-https ca-certificates curl software-properties-common gnupg2
 curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
 apt update 
 apt install -y docker-ce
 docker run hello-world

 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
 apt-get update 
 apt-get install -y nvidia-container-toolkit nvidia-docker2
 docker run --gpus all nvidia/cuda:10.2-base nvidia-smi