1. 更新系统里的所有能更新的软件,更新apt软件包索引并安装软件包,以允许apt通过HTTPS使用存储库
lizhichao@chaochao:~$ sudo apt-get update
lizhichao@chaochao:~$ sudo apt-get install \
> apt-transport-https \
> ca-certificates \
> curl \
> gnupg \
> lsb-release
2. 添加Docker的官方GPG密钥
lizhichao@chaochao:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
3、lizhichao@chaochao:~$ echo \
> "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
4. 更新apt软件包索引,并安装最新版本的Docker Engine和containerd,或转至下一步安装特定版本
lizhichao@chaochao:~$ sudo apt-get update
lizhichao@chaochao:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io
5. 要安装特定版本的Docker Engine,然后试运行
lizhichao@chaochao:~$ systemctl start docker
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'docker.service'.
Authenticating as: repchaochao (lizhichao)
Password:
==== AUTHENTICATION COMPLETE ===
lizhichao@chaochao:~$ sudo docker run hello-world