DockerHub
1 下载最新离线安装包
https://github.com/goharbor/harbor/releases
2 解压下载的压缩包
[admin@controller-server software]$ tar zxf harbor-offline-installer-v2.3.4.tgz[admin@controller-server software]$ cd harbor[admin@controller-server harbor]$ lltotal 596284-rw-r--r-- 1 admin admin 3361 Nov 9 19:01 common.sh-rw-r--r-- 1 admin admin 610560420 Nov 9 19:01 harbor.v2.3.4.tar.gz-rw-r--r-- 1 admin admin 7840 Nov 9 19:01 harbor.yml.tmpl-rwxr-xr-x 1 admin admin 2500 Nov 9 19:01 install.sh-rw-r--r-- 1 admin admin 11347 Nov 9 19:01 LICENSE-rwxr-xr-x 1 admin admin 1881 Nov 9 19:01 prepare#先检测安装环境[admin@controller-server harbor]$ sudo ./prepare
复制一个harbor.yml文件
[admin@controller-server harbor]$ cp harbor.yml.tmpl harbor.yml
编辑harbor.yml文件
hostname: harbor.xxxooog.com //编辑域名# http related confighttp:# port for http, default is 80. If https enabled, this port will redirect to https portport: 80 // 如有冲突,改成自定义端口# https related confighttps:# https port for harbor, default is 443port: 443 // 如有冲突,改成自定义端口# The path of cert and key files for nginxcertificate: /etc/nginx/keys/xxxooo.com.pem // 改成自己域名的证书private_key: /etc/nginx/keys/xxxooo.com.key // 改成自己域名的证书# Remember Change the admin password from UI after launching Harbor.harbor_admin_password: Harbor12345 // 修改默认密码# The default data volumedata_volume: /data/software/harbor/data // 设置data目录,写成相对目录好像有问题,写程绝对目录#其他配置请自行修改
先检测安装环境
[admin@controller-server harbor]$ ./prepareprepare base dir is set to /data/software/harborGenerated configuration file: /config/portal/nginx.confGenerated configuration file: /config/log/logrotate.confGenerated configuration file: /config/log/rsyslog_docker.confGenerated configuration file: /config/nginx/nginx.confGenerated configuration file: /config/core/envGenerated configuration file: /config/core/app.confGenerated configuration file: /config/registry/config.ymlGenerated configuration file: /config/registryctl/envGenerated configuration file: /config/registryctl/config.ymlGenerated configuration file: /config/db/envGenerated configuration file: /config/jobservice/envGenerated configuration file: /config/jobservice/config.ymlGenerated and saved secret to file: /data/secret/keys/secretkeySuccessfully called func: create_root_certGenerated configuration file: /compose_location/docker-compose.ymlClean up the input dir
安装harbor
[admin@controller-server harbor]$ sudo ./install.sh[Step 0]: checking if docker is installed ...Note: docker version: 19.03.13[Step 1]: checking docker-compose is installed ...Note: docker-compose version: 1.29.2[Step 2]: loading Harbor images ...Loaded image: goharbor/harbor-portal:v2.3.4Loaded image: goharbor/nginx-photon:v2.3.4Loaded image: goharbor/notary-server-photon:v2.3.4Loaded image: goharbor/trivy-adapter-photon:v2.3.4Loaded image: goharbor/harbor-core:v2.3.4Loaded image: goharbor/harbor-db:v2.3.4Loaded image: goharbor/harbor-jobservice:v2.3.4Loaded image: goharbor/registry-photon:v2.3.4Loaded image: goharbor/prepare:v2.3.4Loaded image: goharbor/harbor-registryctl:v2.3.4Loaded image: goharbor/harbor-exporter:v2.3.4Loaded image: goharbor/notary-signer-photon:v2.3.4Loaded image: goharbor/harbor-log:v2.3.4Loaded image: goharbor/redis-photon:v2.3.4Loaded image: goharbor/chartmuseum-photon:v2.3.4[Step 3]: preparing environment ...[Step 4]: preparing harbor configs ...prepare base dir is set to /data/software/harborClearing the configuration file: /config/portal/nginx.confClearing the configuration file: /config/log/logrotate.confClearing the configuration file: /config/log/rsyslog_docker.confClearing the configuration file: /config/nginx/nginx.confClearing the configuration file: /config/core/envClearing the configuration file: /config/core/app.confClearing the configuration file: /config/registry/passwdClearing the configuration file: /config/registry/config.ymlClearing the configuration file: /config/registryctl/envClearing the configuration file: /config/registryctl/config.ymlClearing the configuration file: /config/db/envClearing the configuration file: /config/jobservice/envClearing the configuration file: /config/jobservice/config.ymlGenerated configuration file: /config/portal/nginx.confGenerated configuration file: /config/log/logrotate.confGenerated configuration file: /config/log/rsyslog_docker.confGenerated configuration file: /config/nginx/nginx.confGenerated configuration file: /config/core/envGenerated configuration file: /config/core/app.confGenerated configuration file: /config/registry/config.ymlGenerated configuration file: /config/registryctl/envGenerated configuration file: /config/registryctl/config.ymlGenerated configuration file: /config/db/envGenerated configuration file: /config/jobservice/envGenerated configuration file: /config/jobservice/config.ymlGenerated and saved secret to file: /data/secret/keys/secretkeySuccessfully called func: create_root_certGenerated configuration file: /compose_location/docker-compose.ymlClean up the input dir[Step 5]: starting Harbor ...Creating network "harbor_harbor" with the default driverCreating harbor-log ... doneCreating harbor-portal ... doneCreating harbor-db ... doneCreating registry ... doneCreating redis ... doneCreating registryctl ... doneCreating harbor-core ... doneCreating harbor-jobservice ... doneCreating nginx ... done✔ ----Harbor has been installed and started successfully.----
阿里云镜像仓库
私有仓库
docker run -d -p 5000:5000 --restart always --name registry -v /data/registry:/var/lib/registry registry:latest
docker tag registry:latest 192.168.136.131:5000/test
docker push 192.168.136.131:5000/test

