安裝 - jenhaoyang/ml_blog GitHub Wiki
安裝docker
#移除掉可能安裝了舊版或是Ubuntu自帶的 Docker
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
#安裝後續所需抓Docker 安裝包所需的必要程式
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
#讓系統信賴 Docker 安裝倉庫
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce
測試docker
sudo docker run hello-world
安裝nvidia-docker2
# 嘗試移除 nvidia-docker 1.0版,以防萬一
docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f
sudo apt-get purge -y nvidia-docker
# 加入nvidia-docker 2.0版軟體倉庫
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \
sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
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
# 安裝 nvidia-docker2
sudo apt-get install -y nvidia-docker2
#重新載入 Docker daemon
sudo pkill -SIGHUP dockerd
測試nvidia docker
docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi
將使用者加入docker
sudo groupadd docker
sudo usermod -aG docker $USER
# 立刻啟用docker群組
newgrp docker
# 測試
docker run hello-world
參考:
https://ithelp.ithome.com.tw/articles/10205391?sc=iThelpR