首先写好开机启动文件
vim /usr/lib/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
#注意docker-compose和harbor的安装位置
ExecStart=/usr/local/bin/docker-compose -f  /etc/harbor/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /etc/harbor/docker-compose.yml down

[Install]
WantedBy=multi-user.target

现在我们使用命令关闭harbor是没有问题的,但是启动的话有可能会出现问题,根据日志查到下面错误错误,是因为一开始部署harbor的时候没有关闭firewalld。

ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule:  (iptables failed: iptables --wait -t nat -I DOCKER -i br-cd03bf6ce55c -j RETURN: iptables: No chain/target/match by that name.
 (exit status 1))

在关闭firewalld之后重启以下docker

systemctl stop firewalld
systemctl restart docker

再次启动harbor就正常了

systemctl start harbor
netstat -tnlp|grep docker
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      47846/docker-proxy  
tcp        0      0 127.0.0.1:1514          0.0.0.0:*               LISTEN      47222/docker-proxy  

本人新上线的云计算课程已发布地址:https://edu.51cto.com/sd/b1556

GitHub 加速计划 / ha / harbor
10
3
下载
Harbor 是一个开源的容器镜像仓库,用于存储和管理 Docker 镜像和其他容器镜像。 * 容器镜像仓库、存储和管理 Docker 镜像和其他容器镜像 * 有什么特点:支持多种镜像格式、易于使用、安全性和访问控制
最近提交(Master分支:4 个月前 )
a6688903 * fix overlay in replication execution details page Signed-off-by: bupd <bupdprasanth@gmail.com> * fix time overflow in turkish and some languages * minor fix in displaying time Signed-off-by: bupd <bupdprasanth@gmail.com> --------- Signed-off-by: bupd <bupdprasanth@gmail.com> 9 小时前
9231fd2b Bumps [golang.org/x/net](https://github.com/golang/net) from 0.30.0 to 0.33.0. - [Commits](https://github.com/golang/net/compare/v0.30.0...v0.33.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: miner <yminer@vmware.com> 10 小时前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐