安装 Docker
准备安装
卸载旧版本
apt-get remove docker docker-engine docker.io containerd runc
安装 Docker
更新数据源
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 CE
apt-get update && apt-get install -y docker-ce
验证安装是否成功
docker version
配置镜像加速器
获得加速器地址
阿里云加速器
修改配置文件
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["你的加速器地址"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
验证配置是否成功
docker info
====================================================
Registry Mirrors:
https://xxxxxxxx.mirror.aliyuncs.com/