sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates software-properties-common curl
添加 GPG 密钥,并添加 Docker-ce 软件源
官方的软件源(不推荐,很慢):
curl -fsSL https://download.docker.com/linux/ubuntu/gpg|sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
中国科技大学的 Docker-ce 源(其他源类似):
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable"
安装 Docker-ce
sudo apt-get install docker-ce
测试运行
sudo docker run hello-world