docker仓库harbor搭建

1、安装docker-compose

 [root@docker02 ~]# yum install epel-release
[root@docker02 ~]# pip install docker-compose

2、安装harbor

harbor下载地址

https://github.com/vmware/harbor/releases

     [root@docker02 ~]# mv harbor-offline-installer-0.5..tgz  /opt/
[root@docker02 opt]# tar zxvf harbor-offline-installer-0.5..tgz
[root@docker02 harbor]# vim harbor.cfg
## Configuration file of Harbor
#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 = 172.16.138.101 修改hostname
#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
#Email account settings for sending out password resetting emails.
#Email server uses the given username and password to authenticate on TLS connections to host and act as identity.
#Identity left blank to act as username.
email_identity =
email_server = smtp.mydomain.com

3、使用docker节点push 镜像到harbor

修改docker仓库地址

 [root@docker03 images]# vim /etc/sysconfig/docker
....
# If you want to add your own registry to be used for docker search and docker
# pull use the ADD_REGISTRY option to list a set of registries, each prepended
# with --add-registry flag. The first registry added will be the first registry
# searched.
ADD_REGISTRY='--add-registry harbor.suixingpay.com'
# If you want to block registries from being used, uncomment the BLOCK_REGISTRY
# option and give it a set of registries, each prepended with --block-registry
# flag. For example adding docker.io will stop users from downloading images
# from docker.io
# BLOCK_REGISTRY='--block-registry'
# If you have a registry secured with https but do not have proper certs
# distributed, you can tell docker to not look for full authorization by
# adding the registry to the INSECURE_REGISTRY line and uncommenting it.
INSECURE_REGISTRY='--insecure-registry harbor.suixingpay.com'
# On an SELinux system, if you remove the --selinux-enabled option, you
.....

重启docker服务

 [root@docker03 images]# systemctl restart docker.service

登录Harbor(密码:Harbor12345)

 [root@docker03 images]# docker login harbor.suixingpay.com
Username: admin
Password:
Login Succeeded

导入镜像

 [root@docker03 images]# docker load -i heapster_grafana_v2.6.0-.tar
78dbfa5b7cbc: Loading layer [==================================================>] 130.9 MB/130.9 MB
5f70bf18a086: Loading layer [==================================================>] 1.024 kB/1.024 kB
0828a6c7d921: Loading layer [==================================================>] 90.27 MB/90.27 MB
8683f0f614c9: Loading layer [==================================================>] 2.048 kB/2.048 kB
a89b3190964f: Loading layer [==================================================>] 16.26 MB/16.26 MB
ca627f7178ed: Loading layer [==================================================>] 110.1 kB/110.1 kB
edec8b16494f: Loading layer [==================================================>] 4.096 kB/4.096 kB
Loaded image ID: sha256:b4344393062633aad3f68fdee2ac195cfe9d618d6994ef3f3e03dba088a15fa8
[root@docker03 images]#

给镜像打tag

 [root@docker03 images]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
harbor.suixingpay.com/kube/dnsmasq-metrics-amd64 1.0 5271aabced07 months ago MB
<none> <none> b43443930626 months ago MB
[root@docker03 images]# docker tag b43443930626 harbor.suixingpay.com/kube/heapster_grafana:v2.6.0-
[root@docker03 images]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
harbor.suixingpay.com/kube/dnsmasq-metrics-amd64 1.0 5271aabced07 months ago MB
harbor.suixingpay.com/kube/heapster_grafana v2.6.0- b43443930626 months ago MB
[root@docker03 images]#

上次镜像到harbor

 [root@docker03 images]# docker push harbor.suixingpay.com/kube/heapster_grafana:v2.6.0-
The push refers to a repository [harbor.suixingpay.com/kube/heapster_grafana]
5f70bf18a086: Mounted from kube/dnsmasq-metrics-amd64
edec8b16494f: Pushed
ca627f7178ed: Pushed
a89b3190964f: Pushed
8683f0f614c9: Pushed
0828a6c7d921: Pushed
78dbfa5b7cbc: Pushed
v2.6.0-: digest: sha256:daea3fd319873e0f460b26885698a18c0dfcea404d0e03969aeaefeb35d4c278 size:
[root@docker03 images]#

docker仓库harbor搭建

Harbor页面展示

docker仓库harbor搭建

上一篇:小白学 Python 数据分析(8):Pandas (七)数据预处理


下一篇:Socket通信客户端和服务端代码