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
@Ricordel you're right, this leads to broken deployments in case for example the registry is not available (had exactly that case this morning). I've made two changes to this Gist and also to the Ansible role:
reload-or-restart
as you suggesteddocker-compose pull
call non-mandantoryThat way the start will not fail over the pull (it might start slightly older images but hey, better not the recent image than no container, right?) and ensure the service is started…