背景:需要主机安装docker-ce和docer-compose
#1.安装相关依赖.
yum install -y yum-utils device-mapper-persistent-data lvm2
#2.下载官方的docker yum源文件
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#3.替换yum源地址
sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
#4.安装docker-ce
yum makecache fast
yum -y install docker-ce docker-compose
systemctl enable --now docker
#检查
docker version
开启镜像下载加速
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<'EOF'
{
"registry-mirrors": ["https://bjjtv7cs.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
1. 主库harbor配置
1.1. 修改所有docker机器的hosts解析
vim /etc/hosts
10.0.0.81 docker01.tom.cn
10.0.0.82 docker02.tom.cn harbor.tom.cn