Thanks @oelmekki for your insights. It has been very useful and encouraging when there is so few info on rolling updates with docker-compose
.
I ended up writing the following script docker_update.sh <service_name>
, which seems to work very decently. It relies on healthcheck
command, which is not mandatory (change -f "health=healthy"
accordingly) but cleaner IMHO than waiting for container to simply being up, when it takes a little time to boot (which will be the case if you run eg. npm install && npm start
as a command).
#!/bin/bash
cd "$(dirname "$0")/.."
SERVICE_NAME=${1?"Usage: docker_update <SERVICE_NAME>"}