旧版本卸载
apt-get remove docker docker-engine docker.io containerd runc
使用apt安装docker
# 更新数据源
apt-get update
# 安装所需依赖
apt-get -y install apt-transport-https ca-certificates curl software-properties-common
#安装GPG证书
curl -fsSL https://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
apt-get update && apt-get install -y docker-ce
# 验证安装
docker version
使用脚本自动安装docker
//从阿里云镜像安装docker
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh --mirror Aliyun
ubutnu16.04安装docker
https://www.cnblogs.com/hupeng1234/p/9773770.html
ubuntu18.04安装docker
https://www.jianshu.com/p/23ad5f0b7510
docker镜像加速器配置
通过修改daemon配置文件 /etc/docker/daemon.json来使用加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://n5y95k29.mirror.aliyuncs.com"]
}
EOF
重启Docker
systemctl daemon-reload
systemctl restart docker
#验证配置是否成功
docker info