
Overview: Why rollback?
Fly.io runs your apps close to your users, in VMs you can spin up and tear down in seconds. But what if you spin up something broken? If a deploy goes wrong, it’s easy to roll back: just tell Fly to redeploy a previous image. There’s no specialrollback command because you don’t need one. Rollbacks use the same deploy mechanism you already know.
If you know which image was working before, you can deploy it again. You just need to know where to find the image, and how to tell Fly to use it. The trick is: you’re rolling back the VM image, not the database. If you ran migrations in that bad deploy, you’ll have to undo those separately in your application or migration code. Fly isn’t going to time-travel your data.
How to rollback
Step 1: See what you’ve shipped
Fly keeps a history of your releases, including the exact container image each one used. Run:Step 2: Deploy that exact image
Let’s sayv41 was fine. You can redeploy its image directly:
Tip: Stop living in deployment-01HXXXXX hell: use human-readable tags
The default auto-generated tags work for machines, not humans. You can make your life easier by tagging builds with something you’ll recognize later — a git commit hash, a version number, or even just before-i-broke-prod.
When you deploy, pass --image-label to set a tag:
- Builds your app
- Tags the image as
v1.2.3 - Deploys it
How long does Fly keep your images?
Right now, Fly doesn’t promise to store app images forever. If an image hasn’t been deployed for a while, it might be pruned from our registry to free up space. If you need a “guaranteed forever” rollback target, push your image to a public container registry (like Docker Hub, GHCR, or ECR) and deploy from there. See Using the Fly Docker Registry for details.Things to watch out for
Rollbacks are simple in Fly, but they aren’t magic. A few details are worth keeping in mind:- Database schema drift → If a deploy ran destructive migrations (dropping a column, renaming a table), rolling back the app image might not help. Plan migrations so they’re safe both forward and backward.
- Image retention → Images don’t live forever in Fly’s registry. For long-term rollback insurance, push builds to your own container registry.
- Config, Secrets and
fly.toml→ Rollbacks don’t undo config changes. When you deploy an older image, Fly still uses your currentfly.toml, along with whatever env vars and secrets are set now. If a past deploy depended on an older config, you’ll need to update those settings manually when rolling back. - Autoscaling → If your app scaled up during the bad release (say traffic spiked and Fly added more machines), those extra machines don’t vanish the instant you roll back. They’ll hang around until autoscaling decides to scale them down. This is expected behavior and your rollback still worked; you just have more machines than usual for a while. Read more about metrics-based autoscaling.
- Monitoring → Always confirm a rollback stabilized things with logs , probes (
fly logs,fly status,Grafana metrics), not just the success message fromfly deploy. - Regions → By default, rollbacks redeploy globally. If you run in multiple regions (say
iad,lhr,syd), you might test a rollback in just one region before rolling back everywhere. You can do this with the--regionflag:
Tip: Faster rollbacks with deploy strategies
By default, Fly usesrolling deploys: new machines come up before old ones shut down. That’s safe for upgrades, but if you know the current release is bad, you may want a quicker cutover.
All-at-once rollback:
Controlled speedup:
--strategy immediate when speed matters more than downtime, and --max-unavailable when you want a hedge between safety and speed.
Summing up
Rolling back on Fly is basically just deploying an older image. Once you’ve got the muscle memory forfly releases --image and fly deploy --image, it’s a quick, predictable way to recover from bad deploys. And if you start tagging images with human-readable labels, you’ll have an easier time remembering which one to trust when production is on fire.
Related reading
- Seamless Deployments on Fly.io How to set up deploys that avoid downtime and make rollbacks less painful.
- Using the Fly Docker Registry Details on image tagging and retention — key context for understanding how rollbacks work.
- Staging and Production Isolation Tips on environment isolation that reduce the blast radius of a bad release.