Skip to content

Instantly share code, notes, and snippets.

@brian9206
Created April 25, 2020 04:20
Show Gist options
  • Save brian9206/f75b5b5ed54433f68e833125583f8dde to your computer and use it in GitHub Desktop.
Save brian9206/f75b5b5ed54433f68e833125583f8dde to your computer and use it in GitHub Desktop.
[Unit]
Description=%i service with docker compose
Requires=docker.service
After=docker.service
[Service]
Restart=always
WorkingDirectory=/etc/docker/compose/%i
# Compose up
ExecStart=/usr/local/bin/docker-compose up
# Compose down, remove containers and volumes
ExecStop=/usr/local/bin/docker-compose down -v
[Install]
WantedBy=multi-user.target
@brian9206
Copy link
Author

Place it in

/etc/systemd/system/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment