docker安装&镜像加速

  1. 卸载本机自带docker
yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
  1. 安装依赖
yum install -y yum-utils
  1. 设置docker镜像仓库 (这里用的是阿里的,也可以用官方的yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo)
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

设置后需要更新下yum索引

yum makecache fast
  1. 安装docker
yum install docker-ce docker-ce-cli containerd.io
  1. 配置docker镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://vxxxxaaa.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

当yum配置的是官当的地址时,安装出现报错,参考https://stackoverflow.com/questions/65878769/cannot-install-docker-in-a-rhel-server处理

posted @ 2021-03-31 13:35  唐大侠的小迷弟  阅读(47)  评论(0编辑  收藏  举报