部署Docker私有仓库Harbor

部署 Docker

[root@zhupengfei-harbor-centos7-shanghai-area1 ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[root@zhupengfei-harbor-centos7-shanghai-area1 ~]# yum -y install docker-ce
[root@zhupengfei-harbor-centos7-shanghai-area1 ~]# systemctl start docker && systemctl enable docker

Docker Compose 是 Docker 容器进行编排的工具,定义和运行多容器的应用,可以一条命令启动多个容器。

部署 Docker Compose

[root@zhupengfei-harbor-centos7-shanghai-area1 ~]# cd /usr/bin/
[root@zhupengfei-harbor-centos7-shanghai-area1 bin]# rz
[root@zhupengfei-harbor-centos7-shanghai-area1 bin]# mv docker-compose-Linux-x86_64 docker-compose
[root@zhupengfei-harbor-centos7-shanghai-area1 bin]# chmod +x /usr/bin/docker-compose
[root@zhupengfei-harbor-centos7-shanghai-area1 bin]# docker-compose -version
docker-compose version 1.28.5, build c4eb3a1f
[root@zhupengfei-harbor-centos7-shanghai-area1 ~]# cat /etc/docker/daemon.json
{

  "registry-mirrors": ["https://v5d7kh0f.mirror.aliyuncs.com"]

}

[root@zhupengfei-harbor-centos7-shanghai-area1 ~]# wget https://github.com/goharbor/harbor/releases/download/v2.1.4/harbor-online-installer-v2.1.4.tgz
[root@zhupengfei-harbor-centos7-shanghai-area1 ~]# tar -zvxf harbor-online-installer-v2.1.4.tgz
[root@zhupengfei-harbor-centos7-shanghai-area1 ~]# cd harbor/
[root@zhupengfei-harbor-centos7-shanghai-area1 harbor]# ls
common.sh  harbor.yml.tmpl  install.sh  LICENSE  prepare
[root@zhupengfei-harbor-centos7-shanghai-area1 harbor]# cp harbor.yml.tmpl harbor.yml
[root@zhupengfei-harbor-centos7-shanghai-area1 harbor]# vim harbor.yml

port: 80 # 不启用443的,注释掉
hostname: 192.168.13.35
harbor_admin_password: xS@2021

[root@zhupengfei-harbor-centos7-shanghai-area1 harbor]# ./install.sh

[Step 0]: checking if docker is installed ...

Note: docker version: 20.10.5

[Step 1]: checking docker-compose is installed ...

Note: docker-compose version: 1.28.5

[Step 2]: preparing environment ...

[Step 3]: preparing harbor configs ...
prepare base dir is set to /root/harbor
Unable to find image 'goharbor/prepare:v2.1.4' locally
v2.1.4: Pulling from goharbor/prepare
343bd08fd8e0: Pull complete 
ba3b39b2ded0: Pull complete 
402f7b7f719b: Pull complete 
a2b3a9e22dd1: Pull complete 
cdb65ae06f86: Pull complete 
0565baed7a59: Pull complete 
6988abbd3a21: Pull complete 
c7edd40308bd: Pull complete 
Digest: sha256:9910409ea140d5e05ab4e4a0536fdf560f88b06b980e65641e2f840083ecad3d
Status: Downloaded newer image for goharbor/prepare:v2.1.4
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir

[Step 4]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Pulling log (goharbor/harbor-log:v2.1.4)...
v2.1.4: Pulling from goharbor/harbor-log
343bd08fd8e0: Already exists
406594406ae1: Pull complete
da3683650332: Pull complete
29ad7a4cf996: Pull complete
0afb923430c1: Pull complete
b80a569a93c3: Pull complete
7b001d6bf6d4: Pull complete
0cce0fefd1e8: Pull complete
b86d8796fa18: Pull complete
Digest: sha256:92865b0c6918e92dc61be80046b4828dc6ce092aac8091257460a704e57945e0
Status: Downloaded newer image for goharbor/harbor-log:v2.1.4
Pulling registry (goharbor/registry-photon:v2.1.4)...
v2.1.4: Pulling from goharbor/registry-photon
343bd08fd8e0: Already exists
25294021928f: Pull complete
bb3917dee531: Pull complete
cfe42d344ef4: Pull complete
1df8530720d8: Pull complete
113b8b6e8480: Pull complete
Digest: sha256:f109f435873fa47de34fa530ba9dfee5b702295cad70a247bef28a862d03794d
Status: Downloaded newer image for goharbor/registry-photon:v2.1.4
Pulling registryctl (goharbor/harbor-registryctl:v2.1.4)...
v2.1.4: Pulling from goharbor/harbor-registryctl
343bd08fd8e0: Already exists
e3c26f712438: Pull complete
c8958a5d28de: Pull complete
278711085989: Pull complete
6f6bf2afb5e3: Pull complete
065b31e68ec8: Pull complete
3017161e5063: Pull complete
Digest: sha256:c75c4bf0bf2ac3c051c5a412df6b9dbe194bb531f46f33cde554e4c1da0eb54d
Status: Downloaded newer image for goharbor/harbor-registryctl:v2.1.4
Pulling postgresql (goharbor/harbor-db:v2.1.4)...
v2.1.4: Pulling from goharbor/harbor-db
343bd08fd8e0: Already exists
808c9e8ecda4: Pull complete
809dd98a7bdf: Pull complete
0dfd5fd06944: Pull complete
0db0de1bdeb4: Pull complete
e10499444cbf: Pull complete
19570fd72ecb: Pull complete
5c05d60a7a42: Pull complete
071147046d9f: Pull complete
Digest: sha256:01df38dbce5336068ec82f40bc1571a6cfa2cc2d1eb8675e71415465402e9506
Status: Downloaded newer image for goharbor/harbor-db:v2.1.4
Pulling portal (goharbor/harbor-portal:v2.1.4)...
v2.1.4: Pulling from goharbor/harbor-portal
343bd08fd8e0: Already exists
9455bd5f67ef: Pull complete
69d12e5045f8: Pull complete
b20d29b27eb8: Pull complete
b9ede8260d02: Pull complete
3668d96b45fe: Pull complete
c81b9c73e8cd: Pull complete
e892a3362c83: Pull complete
Digest: sha256:865f025f87a888822590f6ef68ca33e0be9094de9b51f67a699d4871f1b77803
Status: Downloaded newer image for goharbor/harbor-portal:v2.1.4
Pulling redis (goharbor/redis-photon:v2.1.4)...
v2.1.4: Pulling from goharbor/redis-photon
343bd08fd8e0: Already exists
f2f3f6f4fc8d: Pull complete
baeaa724c9da: Pull complete
8f3f56a082e7: Pull complete
ff876eb28c7c: Pull complete
Digest: sha256:6f44d0ead827d58b2c52cd63cab69e1db28bb0a2867f7dac644e89c8eb31b4e6
Status: Downloaded newer image for goharbor/redis-photon:v2.1.4
Pulling core (goharbor/harbor-core:v2.1.4)...
v2.1.4: Pulling from goharbor/harbor-core
343bd08fd8e0: Already exists
9c195f491877: Pull complete
b3ccf2752938: Pull complete
752c739fa632: Pull complete
005c32ad1282: Pull complete
5d14f25ffae4: Pull complete
3a70a48ef442: Pull complete
ee96eb06be51: Pull complete
7eb9931b65db: Pull complete
6ffeddbe2b75: Pull complete
Digest: sha256:9c242f891d88d9edbf1b6603f64910d8dd0932b56805fbad1f2a0b8daad55451
Status: Downloaded newer image for goharbor/harbor-core:v2.1.4
Pulling jobservice (goharbor/harbor-jobservice:v2.1.4)...
v2.1.4: Pulling from goharbor/harbor-jobservice
343bd08fd8e0: Already exists
9ca1aa01a405: Pull complete
08b8fee7bea8: Pull complete
6e097af9e876: Pull complete
55dc002b2de0: Pull complete
7891d9aac7a5: Pull complete
Digest: sha256:485a81fdabdc1eb2c97c86506c037aa5d6090185e3300cd24ff7ea86b86364d8
Status: Downloaded newer image for goharbor/harbor-jobservice:v2.1.4
Pulling proxy (goharbor/nginx-photon:v2.1.4)...
v2.1.4: Pulling from goharbor/nginx-photon
343bd08fd8e0: Already exists
e2682c9f3caa: Pull complete
Digest: sha256:5721c120d6e44e1bdc3b9c0d56af57848430cabe5bbca415ff9f353c2f53024a
Status: Downloaded newer image for goharbor/nginx-photon:v2.1.4
Creating harbor-log ... done
Creating redis         ... done
Creating registryctl   ... done
Creating harbor-portal ... done
Creating harbor-db     ... done
Creating registry      ... done
Creating harbor-core   ... done
Creating nginx             ... done
Creating harbor-jobservice ... done
✔ ----Harbor has been installed and started successfully.----

访问Harbor仓库

上一篇
下一篇