安装Docker(ubuntu)
卸载旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
获取软件最新源
sudo apt-get update
安装apt依赖包
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
验证
sudo apt-key fingerprint 0EBFCD88
设置稳定版仓库
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
安装 Docker Engine-Community
更新apt包索引
sudo apt-get update
安装最新版本
sudo apt-get install docker-ce docker-ce-cli containerd.io
测试
sudo docker run hello-world
管理docker
显示docker状态
systemctl status docker
启动docker
systemctl start docker
停止docker
systemctl stop docker
重启docker
systemctl restart docker
开机启动
sudo systemctl enable docker