1. Docker 安装

// 安装前配置

$ setenforce 0
$ sed -i "/^SELINUX/s/enforcing/disabled/" /etc/selinux/config

$ systemctl stop firewalld && systemctl disable firewalld

//安装 Docker

$ wget  -O /etc/yum.repos.d/docker-ce.repo   https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

$ yum list docker-ce --showduplicates|sort -r
$ yum -y install docker-ce

//安装特定版本

yum install docker-ce-<VERSION_STRING>
$ yum -y install docker-ce-18.06.1

2. 配置加速器

$ sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://g9ppwtqr.mirror.aliyuncs.com"]
}
EOF
$ systemctl daemon-reload && systemctl restart docker
$ systemctl enable docker

// 检查加速器是否生效

$ docker info            # 如果生效,会有以下内容
...
Registry Mirrors:
 https://g9ppwtqr.mirror.aliyuncs.com/
...
作者:jackzang  创建时间:2022-10-25 17:35
最后编辑:jackzang  更新时间:2024-07-02 15:50