systems // LinuxLAB

systemd Unit for a Docker Compose Stack

Bring a self-hosted Compose stack up after boot and shut it down cleanly with the host.

linuxsystemddockerboot
Context Pack →Open Workspace →
Trust & provenanceLAB
Evidence tierLABOfficial sources0Other sources0Last verified2026-10-05

Evidence tier describes my hands-on relationship with the content. Official sources describe platform contracts/documentation. Production observations should not automatically be treated as official limits.

EvidenceLAB
Difficultyintermediate
Verified2026-10-05
Use when

A homelab service should recover after reboot without depending on an interactive user session.

[Unit]
Description=VP self-hosted stack
Requires=docker.service
After=docker.service network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/opt/vp-stack
ExecStart=/usr/bin/docker compose up -d
ExecStop=/usr/bin/docker compose down
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target
Why it works

systemd becomes the host-level lifecycle owner while Docker Compose remains the application-level orchestrator.

Operational notes

Use absolute paths in systemd units.

Decide whether docker compose down on host shutdown is desired for your storage and restart model.