question
When the server where Harbor is deployed is restarted, Harbor may fail to follow the system to start automatically
solution
Assume that the installation directory of Harbor is /usr/local/harbor. After the installation of Harbor is completed, a docker-compose.yml configuration file will be generated in this directory. You can use docker-compose to operate this file to control the start and stop of Harbor.
Next, write a self-starting Harbor systemd service, named harbor.service (placed in the /etc/systemd/system directory):
[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/local/bin/docker-compose -f /usr/local/harbor/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /usr/local/harbor/docker-compose.yml down
[Install]
WantedBy=multi-user.target
After the writing is completed, use systemctl enable harbor.service to set the boot to start automatically. Then restart the server to test.