Files
Homelab/homelab.service

21 lines
543 B
Desktop File

[Unit]
Description=Homelab services
Requires=docker.service
After=docker.service
[Service]
Restart=always
User=root
Group=docker
TimeoutStopSec=15
WorkingDirectory=/home/matthew/homelab
# Shutdown container (if running) when unit is started
ExecStartPre=/usr/bin/docker compose -f docker-compose.yaml down
# Start container when unit is started
ExecStart=/usr/bin/docker compose -f docker-compose.yaml up
# Stop container when unit is stopped
ExecStop=/usr/bin/docker compose -f docker-compose.yaml down
[Install]
WantedBy=multi-user.target