Harbor部署

一、Docker-compose部署

[root@docker001 ~]# curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
[root@docker001 bin]# chmod +x /usr/local/bin/docker-compose
[root@docker001 bin]# docker-compose --version
docker-compose version 1.22.0, build f46880fe

二、Harbor部署

1、下载Harbor安装文件

选择离线安装,下载offline文件
harbor-offline-installer-v1.5.1.tgz

2、拷贝至/usr/local

[root@docker001 harbor]# cp harbor-offline-installer-v1.5.1.tgz /usr/local/

3、切到目录下,解压文件

[root@docker001 harbor]# cd /usr/local/
[root@docker001 local]# tar -xzvf harbor-offline-installer-v1.5.1.tgz

4、切换到harbor目录下

[root@docker001 local]# cd harbor
[root@docker001 harbor]# ll
total 856148
drwxr-xr-x 3 root root      4096 Nov 19 13:44 common
-rw-r--r-- 1 root root      1185 May 31 14:45 docker-compose.clair.yml
-rw-r--r-- 1 root root      1725 May 31 14:45 docker-compose.notary.yml
-rw-r--r-- 1 root root      3596 May 31 14:45 docker-compose.yml
drwxr-xr-x 3 root root      4096 May 31 14:45 ha
-rw-r--r-- 1 root root      6687 May 31 14:45 harbor.cfg
-rw-r--r-- 1 root root 876607879 May 31 14:46 harbor.v1.5.1.tar.gz
-rwxr-xr-x 1 root root      5773 May 31 14:45 install.sh
-rw-r--r-- 1 root root     10771 May 31 14:45 LICENSE
-rw-r--r-- 1 root root       482 May 31 14:45 NOTICE
-rwxr-xr-x 1 root root     27379 May 31 14:45 prepare

5、修改配置文件

通过修改docker-compose.yml 修改端口

[root@docker001 harbor]# vi docker-compose.yml 
services:
  log:
    image: vmware/harbor-log:v1.5.1
    container_name: harbor-log
    restart: always
    volumes:
      - /var/log/harbor/:/var/log/docker/:z
      - ./common/config/log/:/etc/logrotate.d/:z
    ports:
      - 1514:1514
    networks:
      - harbor

通过修改harbor.cfg来修改hostname

[root@docker001 harbor]# vi harbor.cfg 
## Configuration file of Harbor

#This attribute is for migrator to detect the version of the .cfg file, DO NOT MODIFY!
_version = 1.5.0
#The IP address or hostname to access admin UI and registry service.
#DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname = docker001

6、重启服务后安装

[root@docker001 harbor]# systemctl start docker.service
[root@docker001 harbor]# ./install.sh 

[Step 0]: checking installation environment ...

Note: docker version: 18.09.1

Note: docker-compose version: 1.22.0

[Step 1]: loading Harbor images ...
52ef9064d2e4: Loading layer  135.9MB/135.9MB
4a6862dbadda: Loading layer  23.25MB/23.25MB
58b7d0c522b2: Loading layer   24.4MB/24.4MB
9cd4bb748634: Loading layer  7.168kB/7.168kB
c81302a14908: Loading layer  10.56MB/10.56MB
7848e9ba72a3: Loading layer  24.39MB/24.39MB
Loaded image: vmware/harbor-ui:v1.5.1
f1691b5a5198: Loading layer  73.15MB/73.15MB
a529013c99e4: Loading layer  3.584kB/3.584kB
d9b4853cff8b: Loading layer  3.072kB/3.072kB
3d305073979e: Loading layer  4.096kB/4.096kB
c9e17074f54a: Loading layer  3.584kB/3.584kB
956055840e30: Loading layer  9.728kB/9.728kB
Loaded image: vmware/harbor-log:v1.5.1
185db06a02d0: Loading layer  23.25MB/23.25MB
835213979c70: Loading layer   20.9MB/20.9MB
f74eeb41c1c9: Loading layer   20.9MB/20.9MB
Loaded image: vmware/harbor-jobservice:v1.5.1
9bd5c7468774: Loading layer  23.25MB/23.25MB
5fa6889b9a6d: Loading layer   2.56kB/2.56kB
bd3ac235b209: Loading layer   2.56kB/2.56kB
cb5d493833cc: Loading layer  2.048kB/2.048kB
557669a074de: Loading layer   22.8MB/22.8MB
f02b4f30a9ac: Loading layer   22.8MB/22.8MB
Loaded image: vmware/registry-photon:v2.6.2-v1.5.1
5d3b562db23e: Loading layer  23.25MB/23.25MB
8edca1b0e3b0: Loading layer  12.16MB/12.16MB
ce5f11ea46c0: Loading layer   17.3MB/17.3MB
93750d7ec363: Loading layer  15.87kB/15.87kB
36f81937e80d: Loading layer  3.072kB/3.072kB
37e5df92b624: Loading layer  29.46MB/29.46MB
Loaded image: vmware/notary-server-photon:v0.5.1-v1.5.1
0a2f8f90bd3a: Loading layer  401.3MB/401.3MB
41fca4deb6bf: Loading layer  9.216kB/9.216kB
f2e28262e760: Loading layer  9.216kB/9.216kB
68677196e356: Loading layer   7.68kB/7.68kB
2b006714574e: Loading layer  1.536kB/1.536kB
Loaded image: vmware/mariadb-photon:v1.5.1
a8c4992c632e: Loading layer  156.3MB/156.3MB
0f37bf842677: Loading layer  10.75MB/10.75MB
9f34c0cd38bf: Loading layer  2.048kB/2.048kB
91ca17ca7e16: Loading layer  48.13kB/48.13kB
5a7e0da65127: Loading layer   10.8MB/10.8MB
Loaded image: vmware/clair-photon:v2.0.1-v1.5.1
0e782fe069e7: Loading layer  23.25MB/23.25MB
67fc1e2f7009: Loading layer  15.36MB/15.36MB
8db2141aa82c: Loading layer  15.36MB/15.36MB
Loaded image: vmware/harbor-adminserver:v1.5.1
3f87a34f553c: Loading layer  4.772MB/4.772MB
Loaded image: vmware/nginx-photon:v1.5.1
Loaded image: vmware/photon:1.0
ad58f3ddcb1b: Loading layer  10.95MB/10.95MB
9b50f12509bf: Loading layer   17.3MB/17.3MB
2c21090fd212: Loading layer  15.87kB/15.87kB
38bec864f23e: Loading layer  3.072kB/3.072kB
6e81ea7b0fa6: Loading layer  28.24MB/28.24MB
Loaded image: vmware/notary-signer-photon:v0.5.1-v1.5.1
897a26fa09cb: Loading layer  95.02MB/95.02MB
16e3a10a21ba: Loading layer  6.656kB/6.656kB
85ecac164331: Loading layer  2.048kB/2.048kB
37a2fb188706: Loading layer   7.68kB/7.68kB
Loaded image: vmware/postgresql-photon:v1.5.1
bed9f52be1d1: Loading layer  11.78kB/11.78kB
d731f2986f6e: Loading layer   2.56kB/2.56kB
c3fde9a69f96: Loading layer  3.072kB/3.072kB
Loaded image: vmware/harbor-db:v1.5.1
7844feb13ef3: Loading layer  78.68MB/78.68MB
de0fd8aae388: Loading layer  3.072kB/3.072kB
3f79efb720fd: Loading layer   59.9kB/59.9kB
1c02f801c2e8: Loading layer  61.95kB/61.95kB
Loaded image: vmware/redis-photon:v1.5.1
454c81edbd3b: Loading layer  135.2MB/135.2MB
e99db1275091: Loading layer  395.4MB/395.4MB
051e4ee23882: Loading layer  9.216kB/9.216kB
6cca4437b6f6: Loading layer  9.216kB/9.216kB
1d48fc08c8bc: Loading layer   7.68kB/7.68kB
0419724fd942: Loading layer  1.536kB/1.536kB
543c0c1ee18d: Loading layer  655.2MB/655.2MB
4190aa7e89b8: Loading layer  103.9kB/103.9kB
Loaded image: vmware/harbor-migrator:v1.5.0


[Step 2]: preparing environment ...
Clearing the configuration file: ./common/config/db/env
Clearing the configuration file: ./common/config/adminserver/env
Clearing the configuration file: ./common/config/jobservice/config.yml
Clearing the configuration file: ./common/config/jobservice/env
Clearing the configuration file: ./common/config/log/logrotate.conf
Clearing the configuration file: ./common/config/registry/config.yml
Clearing the configuration file: ./common/config/registry/root.crt
Clearing the configuration file: ./common/config/ui/private_key.pem
Clearing the configuration file: ./common/config/ui/app.conf
Clearing the configuration file: ./common/config/ui/env
Clearing the configuration file: ./common/config/nginx/nginx.conf
loaded secret from file: /data/secretkey
Generated configuration file: ./common/config/nginx/nginx.conf
Generated configuration file: ./common/config/adminserver/env
Generated configuration file: ./common/config/ui/env
Generated configuration file: ./common/config/registry/config.yml
Generated configuration file: ./common/config/db/env
Generated configuration file: ./common/config/jobservice/env
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/log/logrotate.conf
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/ui/app.conf
Generated certificate, key file: ./common/config/ui/private_key.pem, cert file: ./common/config/registry/root.crt
The configuration files are ready, please use docker-compose to start the service.


[Step 3]: checking existing instance of Harbor ...


[Step 4]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating redis              ... done
Creating harbor-db          ... done
Creating harbor-adminserver ... done
Creating registry           ... done
Creating harbor-ui          ... done
Creating harbor-jobservice  ... done
Creating nginx              ... done

----Harbor has been installed and started successfully.----

Now you should be able to visit the admin portal at http://docker001. 
For more details, please visit https://github.com/vmware/harbor .

7、web访问

在火狐浏览器中访问测试,此处的用户名默认为admin,密码在habor.cfg中,可以自己设置。


image.png

image.png

你可能感兴趣的:(Harbor部署)