HARBOR需要docker17以上
1、docker pull registry:2
2、docker run -d -p 5000:5000 registry:2
curl -i http://localhost:5000/v2/
3、docker tag busybox localhost:5000/busy
4、docker push localhost:5000/busy
搭建HARBOR
5、
yum install -y epel-release
yum clean all
yum install -y docker-compose
yum install -y git wget
wget http://harbor.orientsoft.cn/harbor-v1.3.0-rc4/harbor-offline-installer-v1.3.0-rc4.tgz
tar -zxf harbor-offline-installer-v1.3.0-rc4.tgz
cd harbor
编辑配置文件
vi harbor.cfg
hostname = 192.168.118.77
db_password = harbor123
clair_db_password = harbor123
harbor_admin_password = harbor123
执行安装
./install.sh
更换docker的镜像仓库为私有仓库+daoclound镜像
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
vi /etc/docker/daemon.json
{
"registry-mirrors": ["http://f1361db2.m.daocloud.io"],
"insecure-registries":["192.168.118.77"]
}
systemctl daemon-reload
systemctl restart docker
harbor启动
cd harbor
docker-compose start
上传镜像到harbor
docker tag firstflask:v1 192.168.118.77/library/firstflask:v1
docker push 192.168.118.77/library/firstflask:v1
查看所有镜像
vi get_images.sh
!/bin/bash
USER="admin"
PASS="harbor123"
HURL="http://192.168.118.77"
rtoken={USER}:
{HURL}/service/token?account=
4}')
echo $rtoken
rlist=rtoken "
2}'|awk -F ']' '{print $1}'|sed 's/"//g')
echo $rlist|sed 's/,/\n/g'