1、下载离线安装包
https://github.com/goharbor/harbor/releases
2、安装docker-compose
https://docs.docker.com/compose/install/#install-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
3、解压harbor
自签HTTPS证书方式生产环境不用
https://github.com/goharbor/harbor/blob/master/docs/configure_https.md
不用自签证书用阿里云的ssl证书
修改harbor.cfg配置文件
hostname = hub.hyshi.com
ui_url_protocol = https
customize_crt = off
ssl_cert = ./ssl/215096226100076.pem
ssl_cert_key = ./ssl/215096226100076.key
harbor_admin_password = admin
如果端口占用修改docker-compose.yml配置文件
每次修改完都要
cd /opt/harbor
./prepare
./install.sh
4、停止
docker-compose stop
5、卸载
docker-compose down
rm -rf /data/database
rm -rf /data/registry
6、登录仓库
docker login -uadmin -pzhanshen hub.hyshi.com
7、推送和拉取
docker tag tomcat:7-jre8 hub.hyshi.com/images/tomcat:7-jre8
docker push hub.hyshi.com/images/tomcat:7-jre8
docker pull hub.hyshi.com/images/tomcat:7-jre8