Docker Community Forums

Share and learn in the Docker community.

Upgrade Postgresql from V9.5 to v12.5

I simply want to upgrade Postgresql 9.5 to 12.5, but I must be missing some completely obvious steps. I should mention I’m very new to Docker and how all the pieces fit together. I scoured the internet and searched this site and I can’t find accurate instructions anyplace. At most I find generalized statements that don’t help at all. They’ll say “copy the database directory”. What database directory? I know I have a database, but as you’ll see below, they are nowhere to be found by normal means.

Win 10 Pro
Linux containers
hyper-v
Postgresql 9.5

I backed up the db: docker-compose exec my_db_development pg_dumpall -U {postgres_user} > dump.sql

I’ve seen mentions of shutting down the db and “backing up the db directory”.

  • What directory?
  • I’ve searched my harddrive multiple times and there aren’t any postgresql directories to be found.
  • I can see different application resource directories in Docker->Settings->Resources, but there is no data in those directories.
  • I can see database directories (Unix format) in config screens, but I can’t find these on my harddrive.
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/9.5/bin
    /var/lib/postgresql/data
    /var/lib/docker/volumes/my_db_data/_data

I have pulled a new db image: docker pull postgres:12.5
In docker, I can see the image is there, but it won’t start, nor do I have a clue how to switch to the new db.

What am I missing? Is there a simple “db update” command I can run?

Thanks for any assistance that can be provided.