Centos7 docker、harbor 安装配置
Docker
安装
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
sed -i 's+download.docker.com+mirrors.cloud.tencent.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
yum install docker-ce bash-completion -y
cp /usr/share/bash-completion/completions/docker /etc/bash_completion.d/
systemctl enable --now docker
配置
cat <<EOF> /etc/docker/daemon.json
{
"bip": "192.168.0.1/16",
"exec-opts": ["native.cgroupdriver=systemd"],
"registry-mirrors": ["https://p7n6fyf0.mirror.aliyuncs.com"],
"data-root": "/data/docker",
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m",
"max-file": "3"
}
}
EOF
启动
systemctl daemon-reload
systemctl start docker
Harbor
安装
wget https://github.com/goharbor/harbor/releases/download/v1.9.2/harbor-online-installer-v1.9.2.tgz
tar zxvf harbor-online-installer-v1.9.2.tgz
# 修改 harbor.yml ,hostname 设置为本机ip
[root@h3c-ecs-11-166 harbor]# grep hostname: harbor.yml
hostname: 172.18.11.166
./install.sh
打开浏览器访问服务器ip, 用户admin
,密码 Harbor12345
这样就设置好了,然后要在docker
配置 docker私有仓库的地址
[root@h3c-ecs-11-166 ~]# grep ExecStart /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --insecure-registry 172.18.11.166
[root@h3c-ecs-11-166 ~]# systemctl daemon-reload
[root@h3c-ecs-11-166 ~]# systemctl start docker
登录
[root@h3c-ecs-11-166 ~]# docker login 172.18.11.166
// 根据提示输入用户密码