docker:centos7安装docker环境

参考资料

Docker安装: https://docs.docker.com/engine/install/centos/

阿里云镜像加速器: https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors

Uninstall old versions

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

SET UP THE REPOSITORY

 sudo yum install -y yum-utils
 sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

INSTALL DOCKER ENGINE

sudo yum install -y docker-ce docker-ce-cli containerd.io

Start Docker

sudo systemctl start docker

Verify

sudo docker run hello-world

配置镜像加速器

进入https://cr.console.aliyun.com/cn-hangzhou/instances

选择[镜像工具]->[镜像加速器]->[操作文档]->[CentOS]

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://your-random-string.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
posted @ 2021-03-25 11:18  rxh1999  阅读(42)  评论(0)    收藏  举报