harbor仓库配置开机启动小错误

首先写好开机启动文件
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

你可能感兴趣的:(排错,运维,docker,容器,centos)