1. 程式人生 > >Docker私有倉庫安裝部署

Docker私有倉庫安裝部署

安裝Docker Engine

# If these are installed, uninstall them, along with associated dependencies.
$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine
$ sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
$ sudo yum install docker-ce
$ yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64               18.06.1.ce-3.el7                @docker-ce-stable

安裝Docker Compose

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
docker-compose version 1.22.0, build f46880fe

Harbor二進位制離線包安裝

$ wget https://storage.googleapis.com/harbor-releases/harbor-offline-installer-v1.5.3.tgz
$ tar zxf harbor-offline-installer-v1.5.3.tgz -C /opt/tools/
$ vi /opt/tools/harbor/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 = 192.168.121.150

#The protocol for accessing the UI and token/notification service, by default it is http.
#It can be set to https if ssl is enabled on nginx.
ui_url_protocol = http
$ sudo /opt/tools/harbor/install.sh

[Step 0]: checking installation environment ...

Note: docker version: 18.06.1

Note: docker-compose version: 1.22.0

[Step 1]: loading Harbor images ...
dba693fc2701: Loading layer [==================================================>]  133.4MB/133.4MB
5773887c4c41: Loading layer [==================================================>]  30.09MB/30.09MB
6fc2abbcae42: Loading layer [==================================================>]  15.37MB/15.37MB
d85f176a11ec: Loading layer [==================================================>]  15.37MB/15.37MB
Loaded image: vmware/harbor-adminserver:v1.5.3
462b14c85230: Loading layer [==================================================>]  410.1MB/410.1MB
c2e0c8cb2903: Loading layer [==================================================>]  9.216kB/9.216kB
11bdb24cded2: Loading layer [==================================================>]  9.216kB/9.216kB
5d8f974b49ef: Loading layer [==================================================>]   7.68kB/7.68kB
ee04f13f4147: Loading layer [==================================================>]  1.536kB/1.536kB
799db4dfe41a: Loading layer [==================================================>]  11.78kB/11.78kB
f7d813585bdd: Loading layer [==================================================>]   2.56kB/2.56kB
6300bbdbd7ab: Loading layer [==================================================>]  3.072kB/3.072kB
Loaded image: vmware/harbor-db:v1.5.3
1d7516778a05: Loading layer [==================================================>]  30.09MB/30.09MB
f7ec8d1b47d0: Loading layer [==================================================>]  20.91MB/20.91MB
22b0ad749c21: Loading layer [==================================================>]  20.91MB/20.91MB
Loaded image: vmware/harbor-jobservice:v1.5.3
2d449d67c05a: Loading layer [==================================================>]  89.58MB/89.58MB
0bfd4e706575: Loading layer [==================================================>]  3.072kB/3.072kB
6100e173c230: Loading layer [==================================================>]   59.9kB/59.9kB
86fe093d1358: Loading layer [==================================================>]  61.95kB/61.95kB
Loaded image: vmware/redis-photon:v1.5.3
Loaded image: photon:1.0
3bf3086a6569: Loading layer [==================================================>]  30.09MB/30.09MB
641d0f77d675: Loading layer [==================================================>]  10.95MB/10.95MB
89efbaabea87: Loading layer [==================================================>]   17.3MB/17.3MB
1276e51f4dc2: Loading layer [==================================================>]  15.87kB/15.87kB
49e187d04e78: Loading layer [==================================================>]  3.072kB/3.072kB
e62fbfea411d: Loading layer [==================================================>]  28.24MB/28.24MB
Loaded image: vmware/notary-signer-photon:v0.5.1-v1.5.3
Loaded image: vmware/mariadb-photon:v1.5.3
201f6ade61d8: Loading layer [==================================================>]  102.5MB/102.5MB
81221fbb5879: Loading layer [==================================================>]  6.656kB/6.656kB
2268e3c9e521: Loading layer [==================================================>]  2.048kB/2.048kB
9fca06f4b193: Loading layer [==================================================>]   7.68kB/7.68kB
Loaded image: vmware/postgresql-photon:v1.5.3
11d6e8a232c9: Loading layer [==================================================>]  30.09MB/30.09MB
42650b04d53d: Loading layer [==================================================>]  24.41MB/24.41MB
a1cd8af19e29: Loading layer [==================================================>]  7.168kB/7.168kB
4b1cda90ba19: Loading layer [==================================================>]  10.56MB/10.56MB
1351f0f3006a: Loading layer [==================================================>]   24.4MB/24.4MB
Loaded image: vmware/harbor-ui:v1.5.3
e335f4c3af7d: Loading layer [==================================================>]  79.93MB/79.93MB
2aea487bc2c4: Loading layer [==================================================>]  3.584kB/3.584kB
d2efec3de68b: Loading layer [==================================================>]  3.072kB/3.072kB
d0d71a5ce1dd: Loading layer [==================================================>]  4.096kB/4.096kB
19930367abf0: Loading layer [==================================================>]  3.584kB/3.584kB
03e5b7640db5: Loading layer [==================================================>]  9.728kB/9.728kB
Loaded image: vmware/harbor-log:v1.5.3
5aebe8cc938c: Loading layer [==================================================>]  11.97MB/11.97MB
Loaded image: vmware/nginx-photon:v1.5.3
ede6a57cbd7e: Loading layer [==================================================>]  30.09MB/30.09MB
4d6dd4fc1d87: Loading layer [==================================================>]   2.56kB/2.56kB
c86a69f49f60: Loading layer [==================================================>]   2.56kB/2.56kB
0cf6e04c5927: Loading layer [==================================================>]  2.048kB/2.048kB
6fbff4fe9739: Loading layer [==================================================>]   22.8MB/22.8MB
6f527a618092: Loading layer [==================================================>]   22.8MB/22.8MB
Loaded image: vmware/registry-photon:v2.6.2-v1.5.3
e29a8834501b: Loading layer [==================================================>]  12.16MB/12.16MB
aaf67f1da2c7: Loading layer [==================================================>]   17.3MB/17.3MB
8d5718232133: Loading layer [==================================================>]  15.87kB/15.87kB
fc89aca1dd12: Loading layer [==================================================>]  3.072kB/3.072kB
076eb5a76f6d: Loading layer [==================================================>]  29.46MB/29.46MB
Loaded image: vmware/notary-server-photon:v0.5.1-v1.5.3
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
45878c64fc3c: Loading layer [==================================================>]  165.3MB/165.3MB
fc3d407ce98f: Loading layer [==================================================>]  10.93MB/10.93MB
d7a0785bb902: Loading layer [==================================================>]  2.048kB/2.048kB
a17e0f23bc84: Loading layer [==================================================>]  48.13kB/48.13kB
57c7181f2336: Loading layer [==================================================>]  10.97MB/10.97MB
Loaded image: vmware/clair-photon:v2.0.5-v1.5.3


[Step 2]: preparing environment ...
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.


[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          ... done
Creating harbor-adminserver ... done
Creating registry           ... done
Creating redis              ... 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://192.168.121.150. 
For more details, please visit https://github.com/vmware/harbor .

# the default administrator username/password are admin/Harbor12345 .
$ docker login 192.168.121.150
Username: admin
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
$ docker push 192.168.121.150/my-repos:2.6.2

參考資料