未分类
harbor v2.5.1安装
使用docker-compose来安装harbor v2.5.1,安装过程中有一些问题,下面记录一下: 下载离线安装包:
1 |
wget https://github.com/goharbor/harbor/releases/download/v2.5.1/harbor-offline-installer-v2.5.1.tgz |
2. 准备docker-compose.yml和harbor.yml: docker-compose.yml:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
version: '2.3' services: log: image: goharbor/harbor-log:v2.5.1 container_name: harbor-log restart: always cap_drop: - ALL cap_add: - CHOWN - DAC_OVERRIDE - SETGID - SETUID volumes: - /ali-nas/harbor/log/:/var/log/docker/:z - type: bind source: ./common/config/log/logrotate.conf target: /etc/logrotate.d/logrotate.conf - type: bind source: ./common/config/log/rsyslog_docker.conf target: /etc/rsyslog.d/rsyslog_docker.conf ports: - 127.0.0.1:1514:10514 networks: - harbor registry: image: goharbor/registry-photon:v2.5.1 container_name: registry restart: always cap_drop: - ALL cap_add: - CHOWN - SETGID - SETUID volumes: - /ali-nas/harbor/registry:/storage:z - ./common/config/registry/:/etc/registry/:z - type: bind source: /ali-nas/harbor/secret/registry/root.crt target: /etc/registry/root.crt - type: bind source: ./common/config/shared/trust-certificates target: /harbor_cust_cert networks: - harbor depends_on: - log logging: driver: "syslog" options: syslog-address: "tcp://localhost:1514" tag: "registry" registryctl: image: goharbor/harbor-registryctl:v2.5.1 container_name: registryctl env_file: - ./common/config/registryctl/env restart: always cap_drop: - ALL cap_add: - CHOWN - SETGID - SETUID volumes: - /ali-nas/harbor/registry:/storage:z - ./common/config/registry/:/etc/registry/:z - type: bind source: ./common/config/registryctl/config.yml target: /etc/registryctl/config.yml - type: bind source: ./common/config/shared/trust-certificates target: /harbor_cust_cert networks: - harbor depends_on: - log logging: driver: "syslog" options: syslog-address: "tcp://localhost:1514" tag: "registryctl" postgresql: image: goharbor/harbor-db:v2.5.1 container_name: harbor-db restart: always cap_drop: - ALL cap_add: - CHOWN - DAC_OVERRIDE - SETGID - SETUID volumes: - /ali-nas/harbor/database:/var/lib/postgresql/data:z networks: harbor: env_file: - ./common/config/db/env depends_on: - log logging: driver: "syslog" options: syslog-address: "tcp://localhost:1514" tag: "postgresql" shm_size: '1gb' core: image: goharbor/harbor-core:v2.5.1 container_name: harbor-core env_file: - ./common/config/core/env restart: always cap_drop: - ALL cap_add: - SETGID - SETUID volumes: - /ali-nas/harbor/ca_download/:/etc/core/ca/:z - /ali-nas/harbor/:/data/:z - ./common/config/core/certificates/:/etc/core/certificates/:z - type: bind source: ./common/config/core/app.conf target: /etc/core/app.conf - type: bind source: /ali-nas/harbor/secret/core/private_key.pem target: /etc/core/private_key.pem - type: bind source: /ali-nas/harbor/secret/keys/secretkey target: /etc/core/key - type: bind source: ./common/config/shared/trust-certificates target: /harbor_cust_cert networks: harbor: depends_on: - log - registry - redis - postgresql logging: driver: "syslog" options: syslog-address: "tcp://localhost:1514" tag: "core" portal: image: goharbor/harbor-portal:v2.5.1 container_name: harbor-portal restart: always cap_drop: - ALL cap_add: - CHOWN - SETGID - SETUID - NET_BIND_SERVICE volumes: - type: bind source: ./common/config/portal/nginx.conf target: /etc/nginx/nginx.conf networks: - harbor depends_on: - log logging: driver: "syslog" options: syslog-address: "tcp://localhost:1514" tag: "portal" jobservice: image: goharbor/harbor-jobservice:v2.5.1 container_name: harbor-jobservice env_file: - ./common/config/jobservice/env restart: always cap_drop: - ALL cap_add: - CHOWN - SETGID - SETUID volumes: - /ali-nas/harbor/job_logs:/var/log/jobs:z - type: bind source: ./common/config/jobservice/config.yml target: /etc/jobservice/config.yml - type: bind source: ./common/config/shared/trust-certificates target: /harbor_cust_cert networks: - harbor depends_on: - core logging: driver: "syslog" options: syslog-address: "tcp://localhost:1514" tag: "jobservice" redis: image: goharbor/redis-photon:v2.5.1 container_name: redis restart: always cap_drop: - ALL cap_add: - CHOWN - SETGID - SETUID volumes: - /ali-nas/harbor/redis:/var/lib/redis networks: harbor: depends_on: - log logging: driver: "syslog" options: syslog-address: "tcp://localhost:1514" tag: "redis" proxy: image: goharbor/nginx-photon:v2.5.1 container_name: nginx restart: always cap_drop: - ALL cap_add: - CHOWN - SETGID - SETUID - NET_BIND_SERVICE volumes: - ./common/config/nginx:/etc/nginx:z - type: bind source: ./common/config/shared/trust-certificates target: /harbor_cust_cert networks: - harbor ports: - 81:8080 depends_on: - registry - core - portal - log logging: driver: "syslog" options: syslog-address: "tcp://localhost:1514" tag: "proxy" networks: harbor: external: false |
harbor.yml文件需要更改hostname, 监听port, 如果不开启ssl, 则注释掉https, 更改harbor_admin_password,和data_volume
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
hostname: 172.20.47.2 http: port: 81 harbor_admin_password: xxxxx database: password: root123 max_idle_conns: 100 max_open_conns: 900 data_volume: /ali-nas/harbor trivy: ignore_unfixed: false skip_update: false insecure: false jobservice: max_job_workers: 10 notification: webhook_job_max_retry: 10 chart: absolute_url: disabled log: level: info local: rotate_count: 50 rotate_size: 200M location: /ali-nas/harbor/log _version: 2.5.0 proxy: http_proxy: https_proxy: no_proxy: components: - core - jobservice - trivy |
执行完docker-compose up -d后, 容器全部启来了, 但是再执行docker-compose down后, 再执行install.sh,或up启动,发现有几个问题: docker-compose up启动报错: Creating harbor-log … error ERROR: for harbor-log Cannot start service log: driver failed programming external connectivity on endpoint harbor-log (cb1338bb88ec65aba9727cb1e7656e6c44b3705095121e27ab9240a66cda1ef1): (iptables failed: iptables –wait -t filter Read more…