添加源https://download.docker.com/
Uninstall old versions
sudo apt-get remove docker docker-engine docker.io containerd runc
Install packages to allow apt to use a repository over HTTPS:
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.
$ sudo apt-key fingerprint 0EBFCD88
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <docker@docker.com>
sub 4096R/F273FCD8 2017-02-22
Use the following command to set up the stable repository.
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Update the apt package index.
这里我出现update失败, 有 Ign 出现,需要修改DNS
/etc/resolv.conf,最下面就多了3行:
修改 /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 114.114.114.114
参考文章:https://blog.csdn.net/u012255731/article/details/53167779
安装docker-ce
sudo apt install docker-ce=5:18.09.1~3-0~ubuntu-xenial
安装nvidia-docker2
参考https://blog.csdn.net/chxw098/article/details/79741586
Docker version (>= 19.03) no need nvidia-docker2, use nvidia-container-toolkit
参考docker website