January 4, 2026

Upgrading a Postgres container

With the latest Postgres 18 update, we upgraded all our containers. Here is how to do it without the need for anything fancy.


The first step is to dump your Postgres data and wipe the container and its previous data.

docker compose exec <postgres_container> pg_dumpall -U <postgres_user> > backup.sql
docker compose down <postgres_container>
rm /var/lib/docker/volumes/<postgres_volume>/_data/* -rf


Then, you can create the upgraded container.

postgres: 18
volumes:
  - <postgres_volume>:/var/lib/postgresql/18/docker
docker compose up -d <postgres_container>


The last step is to fill the new Postgres data with your dump.

docker compose exec -T <postgres_container> psql -U <postgres_user> < backup.sql


Done!


Keep the momentum

Ready to automate your next workflow?

We help teams move from manual ops to always-on automation with measurable lift.