卸载之前的docker版本(如果有的话) sudo apt-get remove docker docker-engine docker.io containerd runc
安装docker的依赖包: sudo apt-get update sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
添加docker的官方GPG密钥: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
添加docker的稳定版仓库: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
再次更新软件包列表,并安装最新版本的docker-ce: sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
验证docker是否安装成功,运行一个测试容器: sudo docker run hello-world