ドッカービルドエンタープライズクラスのプライベート倉庫ミラーハーバー

まず、ソフトウェア環境

ホストオペレーティングシステム:CentOSのLinuxリリース7.7

仮想マシンツール:VMware®のワークステーション10

Applicationコンテナエンジン:ドッカーバージョン19.03.7

ミラー倉庫オープンソースソフトウェア:港-オフラインインストーラ-v1.5.0.tgz

コマンドラインツール:ドッキングウィンドウ-コン1.25.4

第二に、実際のタスク

ハーバーハーバービルドエンタープライズクラスの倉庫をミラーリングすることによって、VMwareのエンタープライズクラスのオープンソースプロジェクトドッカーレジストリです。

第三に、実際の手順

インストールパッケージをオフラインでダウンロード1

#インストールは、オンラインおり、オフラインでインストールするには、2つの方法があり、このインストールオフラインモードでは、公式ウェブサイトからダウンロードすることができますが、速度が非常に遅いです。

http://harbor.orientsoft.cn/

http://harbor.orientsoft.cn/harbor-v1.5.0/harbor-offline-installer-v1.5.0.tgz

ドッカーをインストール2.

インストールプロセス

3.インストール]ドッキングウィンドウ、コン

#-Lineインストール

[ルート@ドッキングウィンドウ/]#sudoのカール-L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s) - $(のuname -m)" -o 

/ usr / local / binに/ドッキングウィンドウ、コン

#認証

[ルート@ドッカー/]#のchmodの+ Xは/ usr / local /ビン/ドッカー-COMPOSE

ドッキングウィンドウのcomposejpg.jpg[ルート@ドッキングウィンドウ/]#ドッキングウィンドウ、コン--version

ドッキングウィンドウ・コンバージョン1.25.4、ビルド8d51620a

[ドッキングウィンドウツール@ルート]#RZ

[ドッキングウィンドウツール@ルート]#タールzxvf港 - オフラインインストーラ-v1.5.0.tgz 

[ルート@ドッカツール]#のCD港

image.png

[ドッキングウィンドウの港@ルート]#ます。mkdir SSL

4.自己署名証明書TLS

[ドッキングウィンドウのSSL @ルート]#opensslのREQ -newkey RSA:4096 -nodes -sha256 -keyout ca.key -x509 -days 365 -out ca.crt

[ドッキングウィンドウのSSL @ルート]# 

opensslのREQ \

 -newkey RSA:4096 -nodes -sha256 -keyout reg.sky9899.com。キー\

 -out reg.sky9899.com .csrです

[ルート@ドッカSSL]#LSは

ca.crt ca.key reg.sky9899.com.csr reg.sky9899.com.key

[ルート@ドッカーSSL] #openssl X509 -req -days 365 -in reg.sky9899.com.csr -CA ca.crt -CAkey ca.key -CAcreateserialアウト 

reg.sky9899.com.crt

[ルート@ドッカSSL]#LSは

ca.crt ca.key ca.srl reg.sky9899.com.crt reg.sky9899.com.csr reg.sky9899.com.key

5.Harborのインストールと設定

[ドッキングウィンドウの港@ルート]#viのharbor.cfg 

#に以下の項目を変更します。

ホスト名= reg.sky9899.com

ui_url_protocol = HTTPS

ssl_cert = ./ssl/reg.sky9899.com.crt

ssl_cert_key = ./ssl/reg.sky9899.com.key

harbor_admin_password = Harbor

[root@docker harbor]# ./prepare 

Generated and saved secret to 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.

[root@docker harbor]# ./install.sh 

[Step 0]: checking installation environment ...

Note: docker version: 19.03.8

Note: docker-compose version: 1.25.4

[Step 1]: loading Harbor images ...

52ef9064d2e4: Loading layer [============================>]  135.9MB/135.9MB

c169f7c7a5ff: Loading layer [=============================>]  154.2MB/154.2MB

a2194b3a5434: Loading layer [===========================>]  10.75MB/10.75MB

f3809b773329: Loading layer [============================>]  2.048kB/2.048kB

bdd2cd4d5394: Loading layer [============================>]  48.13kB/48.13kB

bce61638a813: Loading layer [============================>]   10.8MB/10.8MB

Loaded image: vmware/clair-photon:v2.0.1-v1.5.0

0bf5fb4e60f4: Loading layer [==============================>]     95MB/95MB

9fc876f7ef97: Loading layer [==============================>]  6.656kB/6.656kB

9f364ae08e7f: Loading layer [==============================>]  2.048kB/2.048kB

d8e3574f27f2: Loading layer [=============================>]   7.68kB/7.68kB

Loaded image: vmware/postgresql-photon:v1.5.0

8cb812a02f44: Loading layer [============================ >]  23.25MB/23.25MB

826629c35871: Loading layer [============================>]  15.36MB/15.36MB

68fc630fcd08: Loading layer [============================>]  15.36MB/15.36MB

Loaded image: vmware/harbor-adminserver:v1.5.0

fd8233cdfcf0: Loading layer [=============================>]  23.25MB/23.25MB

7ab0310b3d9d: Loading layer [===========================>]   2.56kB/2.56kB

75609935cf31: Loading layer [===========================>]   2.56kB/2.56kB

654b65c0f8ff: Loading layer [===========================>]  2.048kB/2.048kB

1da5c77da464: Loading layer [===========================>]   22.8MB/22.8MB

5e9191f65a4c: Loading layer [===========================>]   22.8MB/22.8MB

Loaded image: vmware/registry-photon:v2.6.2-v1.5.0

Loaded image: vmware/photon:1.0

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

1736beaf11c8: Loading layer [===============================>]  23.25MB/23.25MB

3026403c0282: Loading layer [===============================>]  24.39MB/24.39MB

1aaf4a794824: Loading layer [===============================>]  7.168kB/7.168kB

b427e1a2dd17: Loading layer [==============================>]  10.56MB/10.56MB

68906d88fd96: Loading layer [==============================>]  24.38MB/24.38MB

Loaded image: vmware/harbor-ui:v1.5.0

cf8fe5c86f4b: Loading layer [================================>]  78.26MB/78.26MB

d15d127e6aa2: Loading layer [==============================>]  3.072kB/3.072kB

9d47dbd3d824: Loading layer [===============================>]   59.9kB/59.9kB

098c90ca59f4: Loading layer [================================>]  61.95kB/61.95kB

Loaded image: vmware/redis-photon:v1.5.0

71a9f645bc2d: Loading layer [================================>]  4.755MB/4.755MB

Loaded image: vmware/nginx-photon:v1.5.0

c4c015394057: Loading layer [===============================>]  401.3MB/401.3MB

f9d78b9c2c97: Loading layer [===============================>]  9.216kB/9.216kB

5cf7df688ef1: Loading layer [===============================>]  9.216kB/9.216kB

9513efb6efc9: Loading layer [===============================>]   7.68kB/7.68kB

52252ffb5fc7: Loading layer [===============================>]  1.536kB/1.536kB

Loaded image: vmware/mariadb-photon:v1.5.0

243e37f674cb: Loading layer [=================================>]  23.25MB/23.25MB

eb85e1888b13: Loading layer [=================================>]  10.95MB/10.95MB

7b86ea27af2e: Loading layer [=================================>]   17.3MB/17.3MB

a876e7e90459: Loading layer [==================================>]  15.87kB/15.87kB

08c705395182: Loading layer [=================================>]  3.072kB/3.072kB

2cb9ada082da: Loading layer [=================================>]  28.24MB/28.24MB

Loaded image: vmware/notary-signer-photon:v0.5.1-v1.5.0

b9abce7219b5: Loading layer [================================>]  73.15MB/73.15MB

ee87a4f06084: Loading layer [=================================>]  3.584kB/3.584kB

Loaded image: vmware/harbor-log:v1.5.0

bed1e891c86f: Loading layer [===============================>]  3.072kB/3.072kB

Loaded image: vmware/harbor-db:v1.5.0

820ecb80c0fa: Loading layer [==============================>]  23.25MB/23.25MB

Loaded image: vmware/harbor-jobservice:v1.5.0

6ae72c7ad4ac: Loading layer [===============================>]  12.16MB/12.16MB

Loaded image: vmware/notary-server-photon:v0.5.1-v1.5.0

[Step 2]: preparing environment ...

Clearing the configuration file: ./common/config/adminserver/env

Clearing the configuration file: ./common/config/ui/env

Clearing the configuration file: ./common/config/ui/app.conf

Clearing the configuration file: ./common/config/ui/private_key.pem

Clearing the configuration file: ./common/config/db/env

Clearing the configuration file: ./common/config/jobservice/env

Clearing the configuration file: ./common/config/jobservice/config.yml

Clearing the configuration file: ./common/config/registry/config.yml

Clearing the configuration file: ./common/config/registry/root.crt

Clearing the configuration file: ./common/config/nginx/cert/reg.sky9899.com.crt

Clearing the configuration file: ./common/config/nginx/cert/reg.sky9899.com.key

Clearing the configuration file: ./common/config/nginx/nginx.conf

Clearing the configuration file: ./common/config/log/logrotate.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 harbor-db  ... 

Creating registry           ... error

Creating harbor-adminserver ... 

Creating redis              ... 

Creating harbor-db          ... done

ERROR: for registry  Cannot create container for service registry: Conflict. The container name "/registry" is already in use by 

contCreating harbor-adminserver ... done

Creating redis              ... done

ERROR: for registry  Cannot create container for service registry: Conflict. The container name "/registry" is already in use by 

container "b697d68647a95e01ee09115c3b9c035a393cac7e51f96e2e58c1896b500e8cfb". You have to remove (or rename) that container to be able 

to reuse that name.

ERROR: Encountered errors while bringing up the project.

#有存在容器重名的,也有宿主机占用了端口,导致端口冲突的,都会导致Harbor安装失败。

#只有解决不重名,或删除或停止冲突的容器,解决端口冲突的问题,才能成功安装Harbor。

#解决办法

[root@docker harbor]# docker stop registry && \

> docker rm -v registry

registry

registry

#停止宿主机80端口

[root@docker harbor]# ./install.sh 

[Step 0]: checking installation environment ...

Note: docker version: 19.03.8

Note: docker-compose version: 1.25.4

[Step 1]: loading Harbor images ...

Loaded image: vmware/clair-photon:v2.0.1-v1.5.0

Loaded image: vmware/postgresql-photon:v1.5.0

Loaded image: vmware/harbor-adminserver:v1.5.0

Loaded image: vmware/registry-photon:v2.6.2-v1.5.0

Loaded image: vmware/photon:1.0

Loaded image: vmware/harbor-migrator:v1.5.0

Loaded image: vmware/harbor-ui:v1.5.0

Loaded image: vmware/redis-photon:v1.5.0

Loaded image: vmware/nginx-photon:v1.5.0

Loaded image: vmware/mariadb-photon:v1.5.0

Loaded image: vmware/notary-signer-photon:v0.5.1-v1.5.0

Loaded image: vmware/harbor-log:v1.5.0

Loaded image: vmware/harbor-db:v1.5.0

Loaded image: vmware/harbor-jobservice:v1.5.0

Loaded image: vmware/notary-server-photon:v0.5.1-v1.5.0

.......................

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

[Step 4]: starting Harbor ...

Creating harbor-log ... done

Creating harbor-adminserver ... done

Creating harbor-db          ... done

Creating registry           ... done

Redisの作成...行って

港-UIを作成しています...行って

作成nginxの...行って

港ジョブサービスを作成しています...寄付しました

----ハーバーがインストールされ、正常に起動されました.----

今、あなたはhttps://reg.sky9899.comで管理ポータルを訪問することができるはずです。 

詳細については、https://github.com/vmware/harborをご覧ください。

6.Dockerのホストアクセスハーバー

ドッキングウィンドウ-commpose.jpg

harbor.jpg

habor2.jpg

harbo3.jpg

#IPアクセスを直接使用することができ、それはまた、ドメイン名を使用してアクセスすることができます。

#DOは、ローカルホストのドメイン名解決に、あなたがアクセスすることができない、そのような "C:\ WINDOWS \ System32に\ drivers \ etcに\ホスト" として、

#192.168.153.141 reg.sky9899.com

おすすめ

転載: blog.51cto.com/sky9896/2480453