File | Purpose |
---|---|
/etc/compose/docker-compose.yml |
Compose file describing what to deploy |
/etc/systemd/system/docker-compose-reload.service |
Executing unit to trigger reload on docker-compose.service |
/etc/systemd/system/docker-compose-reload.timer |
Timer unit to plan the reloads |
/etc/systemd/system/docker-compose.service |
Service unit to start and manage docker compose |
Put the above mentioned files in the corresponding places and let systemd load them:
# systemctl daemon-reload
# systemctl enable --now docker-compose.service docker-compose-reload.timer
The method shown here is also available as an Ansible role here: luzifer-ansible/docker-compose
Thank you for sharing this. Eventhough i find your approach clean and fairly complete, i ask myself why most ( all ) people insist on using
down
on stop and notstop
- @Luzifer could you elaborate?I mean, i am not talking about those people how use
down -v
since they entirely do not understand the lifecycle, i still ask myself, whydown
in your case.This will take a considirable amount of time longer to start up since all containers need to be recreated. I understand, this is dockerish - but throwing away containers just like that is not what is intended. I understand, that if i container is flapping / erroring, just recreate it, do not even bother - recreate instantly by all means.
But
down + up
takes time, this adds up to downtime and without having a particular reason for that just does not sound to me.Are there technical reasons? i could think about a specific scenario, and that is the difference between "down + up" and
up
with a "newer image" which will recreate the container anyway. While thedown - up
will properly delete the anon volumes and thus the created container is really fresh,up
with a newer image ( aka recreate ) will reuse all anon volumes - this is a pretty critical detail and could lead to issues with so called code containers and mostvolume_from
designed mounts ( to e.g. forward proxies like nginx and so on ).Did you consider that is specific as a tradeoff or what are your thoughts on this?