卸载旧版本
apt-get remove docker docker-engine docker.io containerd runc
使用 APT 安装(建议使用)
# 更新数据源apt-get update# 安装所需依赖apt-get -y install apt-transport-https ca-certificates curl software-properties-common# 安装 GPG 证书curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -# 新增数据源add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"# 更新并安装 Docker CEapt-get update && apt-get install -y docker-ce
使用脚本安装
# 下载脚本文件curl -fsSL get.docker.com -o get-docker.sh# 启动脚本sh get-docker.sh --mirror Aliyun
镜像加速(阿里)
注: 国内镜像加速器可能会很卡,请替换成你自己阿里云镜像加速器,地址如:
https://yourself.mirror.aliyuncs.com,在阿里云控制台的 容器镜像服务 -> 镜像加速器 菜单中可以找到
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://rp9zscnl.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://hub-mirror.c.163.com/"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
