Use docker stop in systemd services

This commit is contained in:
Hugo Peixoto 2022-10-02 13:16:47 +01:00
parent 4c05a03f93
commit b3b8aeaedb
2 changed files with 4 additions and 2 deletions

View File

@ -6,7 +6,8 @@ After=network-online.target
[Service] [Service]
Restart=on-failure Restart=on-failure
TimeoutStopSec=70 TimeoutStopSec=70
ExecStart=/usr/bin/docker run --rm -it --name postgres --env-file /srv/postgres/env -v /srv/postgres/data:/var/lib/postgresql/data -p5432:5432 postgres:latest ExecStart=/usr/bin/docker run --rm --name postgres --env-file /srv/postgres/env -v /srv/postgres/data:/var/lib/postgresql/data -p5432:5432 postgres:latest
ExecStop=/usr/bin/docker stop postgres
[Install] [Install]
WantedBy=multi-user.target default.target WantedBy=multi-user.target default.target

View File

@ -6,7 +6,8 @@ After=network-online.target container-postgres.service
[Service] [Service]
Restart=on-failure Restart=on-failure
TimeoutStopSec=70 TimeoutStopSec=70
ExecStart=/usr/bin/docker run --pull=always --rm -it --name saucy --env-file /srv/saucy/env -v /srv/saucy/data:/data -p80:3000 git.ansol.org/ansol/saucy:latest ExecStart=/usr/bin/docker run --pull=always --rm --name saucy --env-file /srv/saucy/env -v /srv/saucy/data:/data -p80:3000 git.ansol.org/ansol/saucy:latest
ExecStop=/usr/bin/docker stop saucy
[Install] [Install]
WantedBy=multi-user.target default.target WantedBy=multi-user.target default.target