Skip to content

Instantly share code, notes, and snippets.

@pikatenor
Created September 23, 2021 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pikatenor/12391a572d6b224217b51e35d9673bbf to your computer and use it in GitHub Desktop.
Save pikatenor/12391a572d6b224217b51e35d9673bbf to your computer and use it in GitHub Desktop.
[Unit]
Description=docker-compose %i service
Requires=docker.service network-online.target
[Service]
User=compose
Type=simple
Restart=always
RestartSec=180s
WorkingDirectory=/home/compose/docker-compose.d
Environment=COMPOSE_FILE=/home/compose/docker-compose.d/%i.yml
ExecStart=/usr/local/bin/docker-compose -f ${COMPOSE_FILE} up --force-recreate --abort-on-container-exit
ExecStop=/usr/local/bin/docker-compose -f ${COMPOSE_FILE} stop
ExecStopPost=-/usr/local/bin/docker-compose -f ${COMPOSE_FILE} down -v
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment