Rebuildable Airflow: snapshot the running container, redeploy with a rollback
Update 2026-11-11 17:30: image tags are now the build time,
yyyymmddTHHMMSS(e.g.airflow:20261111T172041), so two builds on the same day no longer collide, and./run.shwith no tag lists what’s available. The outputs below are from the first build, which still used a plain date tag,20261111. The downloadable scripts are the current versions.
The outage postmortem had one recurring theme: every time someone rebuilt the Airflow container by hand, it came back missing something. A mount, the concurrency settings, the plugin, the registry login. The image was whatever someone last typed, and the settings that mattered lived only in a running container.
So the same afternoon I wrote three small scripts. build.airflow.sh turns the running container into an image tagged with its build time (airflow:20261111T172041), pushes it, and saves a tarball. run.sh recreates the container from that tag and checks it’s actually healthy, or puts the old one back. restart.sh runs inside the container and keeps the scheduler and webserver up. From the 170 entries in docker diff, the image keeps 13 files (172K). A redeploy is healthy about 15 s after the new container starts, and a failed one rolls back in 1 s.





