企业级Docker私有仓库之Harbor部署(http)

部署环境

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

Docker及Docker-compose安装

1
2
3
4
5
6
7
8
9
10
11
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部署配置

1
2
3
4
5
6
7
8
9
10
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修改方式为:

1
2
3
4
5
vim /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry hub.wow
systemctl daemon-reload
systemctl reload docker

1
2
3
4
5
6
7
8
9
10
[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服务管理

1
2
cd harbor/
docker-compose -f ./docker-compose.yml [ up|down|ps|stop|start ]
坚持原创分享,您的支持将鼓励我继续创作