1. 程式人生 > >企業級Docker私有倉庫之Harbor部署(http)

企業級Docker私有倉庫之Harbor部署(http)

eat 部署 tar lib 圖片 默認 epo ble try

部署環境

  • Centos7.3 x64
  • docker-ce-17.06.0
  • docker-compose-1.15.0
  • Python-2.7.5(系統默認)

Docker及Docker-compose安裝

 yum install -y yum-utils device-mapper-persistent-data lvm2
 yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
 yum-config-manager --enable docker-ce-edge
 yum makecache fast
 systemctl start docker 
 systemctl enable docker
curl 
-L https://github.com/docker/compose/releases/download/1.15.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose

Habor部署配置

wget https://github.com/vmware/harbor/releases/download/v1.1.2/harbor-offline-installer-v1.1.2.tgz
tar xf harbor-offline-installer-v1.1.2.tgz
cd harbor
/ vim harbor.cfg hostname = hub.wow 其他默認(http協議) ./install.sh 安裝成功後,可以通過http://hub.wow/訪問

技術分享圖片

Docker客戶端使用

由於Harbor默認使用的http協議,故需要在Docker client上的Dockerd服務增加–insecure-registry hub.wow
Centos7修改方式為:

vim /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry hub.wow
 
systemctl daemon-reload
systemctl reload docker
[root@localhost harbor]# docker login -u admin -p Harbor12345 hub.wow
官方倉庫下載busybox鏡像
[root@localhost harbor]# docker pull busybox
[root@localhost harbor]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest efe10ee6727f 2 weeks ago 1.13MB
本地基於busybox:latest創建標記hub.wow/busybox:latest
[root@localhost harbor]# docker tag busybox:latest hub.wow/project_name/busybox:latest
推送本地鏡像busybox:latest 到hub.wow私有倉庫
[root@localhost harbor]# docker push hub.wow/project_name/busybox:latest

Harbor服務管理

cd harbor/
docker-compose -f ./docker-compose.yml [ up|down|ps|stop|start ]

企業級Docker私有倉庫之Harbor部署(http)