Solve the problem that Gabor can’t start itself after the server is restarted

Questions

When the server deployed with Gabor restarts, it may appear that Gabor can’t follow the system to start itself

Solution

Now assume that the location of the installation directory of Gabor is/usr/local/Gabor. After the installation of Gabor, the docker-compose.yml configuration file will be generated in this directory. You can use docker compose to operate this file to control the startup and shutdown of Gabor.

Next, write a system D service that starts from Gabor, named Gabor. Service (placed in the/etc/system/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 writing, use systemctl enable harbor.service to set the boot time. Then restart the server for testing.

Read More: