TechSomething

docker-compose systemd unit file

Scope: #

creating a systemd unit file for a docker-compose service

Unit file: #

edit /etc/systemd/system/something.service

Description=Docker Compose service
Requires=docker.service
After=docker.service

[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/data/docker-compose/service
ExecStart=/usr/local/bin/docker-compose up -d
ExecStop=/usr/local/bin/docker-compose down
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

then start and enable the unit on boot:

systemctl enable --now something.service