【ubuntu 20.04】安装部署内网镜像服务器Harbor-1.10.7
1. 官网链接
https://goharbor.io/docs/2.4.0/
2. 项目地址
https://github.com/goharbor/harbor/releases
3. 安装
wget https://storage.googleapis.com/harbor-releases/release-1.10.0/harbor-online-installer-v1.10.7.tgz tar zxvf harbor-online-installer-v1.10.7.tgz ~
vim harbor.yml
sudo bash ./install.sh
✔ ----Harbor has been installed and started successfully.---- Now you should be able to visit the admin portal at http://192.168.10.99:8090. For more details, please visit https://github.com/goharbor/harbor .
过程会拉取docker镜像到本地
4. 查看结果 http://192.168.10.99:8090/
使用默认账号,admin和默认配置文件中的密码Harbor12345登录
5. 配置开机启动
sudo vim /etc/rc.local
添加
cd $HOME/harbor && docker-compose up -d
6. 为Harbor配置HPPTS
https://goharbor.io/docs/2.0.0/install-config/configure-https/
7. 重启后 harbor的某些容器不能自动启动起来
sudo vim /etc/systemd/system/harbor.service
[Unit]
Description=Harbor
After=docker.service systemd-networkd.service systemd-resolved.service
Requires=docker.service
Documentation=http://github.com/vmware/harbor
[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/usr/bin/docker-compose -f /home/master/harbor/docker-compose.yml up
ExecStop=/usr/bin/docker-compose -f /home/master/harbor/docker-compose.yml down
[Install]
WantedBy=multi-user.target
相关操作
# 服务相关操作
sudo systemctl enable harbor
sudo systemctl start harbor
sudo systemctl stop harbor
# 修改配置文件后,需要重现reload
sudo systemctl daemon-reload
# 查看服务状态
sudo systemctl status harbor.service
9. 配置
sudo vim /etc/docker/daemon.json
{ "registry-mirror": [ "https://hub-mirror.c.163.com", "https://mirror.baidubce.com" ], "insecure-registries": [ "192.168.10.99:8090" ] }
sudo service docker restart
10. 使用
docker login 192.168.100.10:99:8090 -u admin -p Harbor12345
#拉取镜像 docker pull hello-world #给镜像打tag(镜像的格式为,镜像仓库IP:端口/镜像名称) docker tag hello-world 192.168.10.99:8090/test/hello-world #PUSH到仓库 docker push 192.168.10.99:8090/test/hello-world
test为项目名称
上传的镜像
参考链接:
https://blog.csdn.net/zhangyizhanghao/article/details/122034511
https://www.cnblogs.com/majiang/p/11218792.html