一、Harbor简介
Harbor是一个用于存储和分发Docker镜像的企业级私有Registry服务器。
二、Harbor安装
1、下载Harbor包
官网地址:https://github.com/goharbor/harbor/releases
2、下载harbor-online-installer-v1.7.5.tgz
3、下载软件
cd /data/harbor/
wget https://storage.googleapis.com/harbor-releases/release-1.7.0/harbor-online-installer-v1.7.5.tgz
sudo tar xf harbor-online-installer-v1.7.5.tgz
4、开始安装
[root@qa02v harbor]# [root@qa02v harbor]# docker-compose pull
[root@qa02v harbor]# [root@qa02v harbor]# ./install.sh 总用量 1588 drwxr-xr-x 4 root root 35 1月 20 12:16 common -rw-r--r-- 1 root root 727 11月 9 2018 docker-compose.chartmuseum.yml -rw-r--r-- 1 root root 777 11月 9 2018 docker-compose.clair.yml -rw-r--r-- 1 root root 1258 11月 9 2018 docker-compose.notary.yml -rw-r--r-- 1 root root 3591 1月 20 12:35 docker-compose.yml drwxr-xr-x 3 root root 131 11月 9 2018 ha -rw-r--r-- 1 root root 7908 1月 20 12:14 harbor.cfg -rwxr-xr-x 1 root root 6162 11月 9 2018 install.sh -rw-r--r-- 1 root root 10768 11月 9 2018 LICENSE -rw-r--r-- 1 root root 482 11月 9 2018 NOTICE -rw-r--r-- 1 root root 1535603 11月 9 2018 open_source_license -rwxr-xr-x 1 root root 39496 11月 9 2018 prepare
#######################################################
harbor.cfg #这就是harbor的配置文件了
install.sh #安装脚本
docker-compose.yml #docker-compose启动文件
#修改配置文件
# sudo vi /data/harbor/harbor.cfg
hostname = XXX.XXX.XXX.XXX #如果端口冲突则增加端口信息 hostname = XXX.XXX.XXX.XXX:XXX
harbor_admin_password = xxxxxxx (备注:密码自己设置8位,默认Harbor12345)
# sudo vi docker-compose.yml
如果端口冲突,就更改端口: 80改成:8080
5、启动harbor
nulige@harbor:/nulige/tools/harbor$ sudo docker-compose up -d harbor-log is up-to-date harbor-adminserver is up-to-date harbor-db is up-to-date registry is up-to-date redis is up-to-date registryctl is up-to-date harbor-core is up-to-date harbor-portal is up-to-date harbor-jobservice is up-to-date Recreating nginx ... Recreating nginx ... done
6、登录首页
http://XXX.XXX.XXX.XXX:XXX
账号: admin
密码:xxxxxxxx (自已设置的密码)
7、修改daemon.json
[root@qa02v harbor]# cat /etc/docker/daemon.json {"insecure-registries":["XXX.XXX.XXX.XXX:XXX"] } { "credsStore": "pass" }
8、重启docker
[root@qa02v harbor]# systemctl restart docker
9、登录docker
docker login -u admin -p Harbor12345 http://XXX.XXX.XXX.XXX:XXX
10、修改tag
docker tag docker.io/jrottenberg/ffmpeg XXX.XXX.XXX.XXX:XXX/shtest/ffmpeg:v1.0
11、上传镜像至Harbor
docker push XXX.XXX.XXX.XXX:XXX/shtest/ffmpeg:v1.0
12、下载镜像至本地
docker pull XXX.XXX.XXX.XXX:XXX/shtest/ffmpeg:v1.0
=========
docker login 遇到的问题:
Username: yanshinian
Password:
Error saving credentials: error storing credentials - err: exit status 1, out: `The user name or passphrase you entered is not correct.`
参考链接:https://github.com/docker/docker-credential-helpers/issues/65
解决办法:rm /usr/local/bin/docker-credential-osxkeychain
========
参考资料: