Quick answer
What this guide helps you do
Update Docker Compose services with release checks, version pinning, verified backups, controlled pulls, health checks and a practical rollback plan.
Treat an update as replacement
Compose normally pulls a new image and recreates the container. Persistent data remains, but application migrations may change its format. A safe recovery set includes the Compose definition, exact image reference, persistent state, secrets and restore plan.
Record the current state
sudo docker compose config --images
sudo docker compose ps
sudo docker image ls --digests
sudo docker inspect YOUR_CONTAINER --format '{{.Config.Image}} {{.Image}}'
Also record the application version. A tag such as latest is not a version record.
Read official release notes
Check the supported upgrade path, breaking settings, database migrations, removed variables, minimum dependencies and rollback limitations. Some upgrades require intermediate releases.
Back up before pulling
Create consistent database exports, back up bind mounts or named volumes, copy Compose and environment files, verify dates and checksums, and know how to restore them. A snapshot can be a short safety net but is not an independent backup.
Pull and apply deliberately
sudo docker compose config
df -hT
sudo docker system df
sudo docker compose pull
sudo docker compose up -d
sudo docker compose ps
sudo docker compose logs --timestamps --tail=150
Do not add down -v. Test login, existing records, a controlled write, background jobs and dependent services.
Roll back the full state
If no irreversible migration occurred, restore the previous image reference and recreate the service. If the application changed its database or data format, follow its rollback documentation or restore the complete pre-update data set. Changing only the image may make matters worse.
Delay cleanup
Keep previous images for a controlled rollback window. Inspect with docker image ls and docker system df -v, then remove only identified unused resources. Avoid blind scheduled pruning.
Verification checklist
- Current versions are recorded.
- Release notes were read.
- Persistent state and configuration are backed up.
- Restore is proven.
- Compose validates.
- Disk space is sufficient.
- Logs and application behaviour are checked.
- Rollback remains available.
These are update controls, not evidence of a tested upgrade for every third-party application.
Next: Mount a Drive Automatically with fstab on Ubuntu Server. Return to How to Install Docker on Ubuntu Server.
Official references: docker compose pull and docker compose up.