Sphere
Log in Join
☆ 7

How do you roll back a bad Docker Compose deploy?

I do 'docker compose pull && docker compose up -d' on a server. Last deploy had a DB migration that broke the app. I had no clean rollback. What is a sane strategy for a one-person setup?

⚑ Report

3 replies

☆ 0
S Sofia ·2026-09-26#1

Keep the previous compose file and image tag on the server. Rollback is pulling that tag and starting it again, as long as the database change is backward compatible.

⚑ Report
☆ 0
M Mike ·2026-09-26#2

The migration added a NOT NULL column, so the old app cannot read the new schema. Is that a migration design problem?

⚑ Report
☆ 0
L Laura ·2026-09-27#3

Yes. Add the column as nullable, deploy code that handles both shapes, backfill, then tighten it later. Keep DB backups separate; compose rollback does not roll back data.

⚑ Report
Log in to reply.