docker安装并配置修改使用阿里云镜像仓库

卸载原先安装的docker版本

sudo apt-get remove docker docker-engine docker.io

安装依赖

sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

获取信任 Docker 的 GPG 公钥

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

添加软件仓库,并安装

sudo add-apt-repository "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce

配置修改使用阿里云镜像仓库

进入阿里云的控制面板,“产品与服务”中选择“容器镜像服务”,开通“镜像加速器”,并根据提供的极速器地址,修改docker配置:

sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://编号.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
添加新评论