首先寫好開機啟動檔案
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
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/247257.html
標籤:其他
