Created
February 19, 2018 02:57
-
-
Save dfa1234/b26d891cb0c0acfa4cce7ad117eceab4 to your computer and use it in GitHub Desktop.
/etc/systemd/system/docker-wordpress.service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=docker-wordpress | |
Requires=docker.service | |
After=docker.service | |
[Service] | |
Restart=always | |
WorkingDirectory=/home/dfa1324/docker-wordpress | |
# Remove old containers, images and volumes | |
ExecStartPre=/usr/local/bin/docker-compose down -v | |
ExecStartPre=/usr/local/bin/docker-compose rm -fv | |
ExecStartPre=-/bin/bash -c 'docker volume ls -qf "name=%i_" | xargs docker volume rm' | |
ExecStartPre=-/bin/bash -c 'docker network ls -qf "name=%i_" | xargs docker network rm' | |
ExecStartPre=-/bin/bash -c 'docker ps -aqf "name=%i_*" | xargs docker rm' | |
# 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 | |
Author
dfa1234
commented
Feb 19, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment