So as the title says i have a dockerized postgres database on a rails app. I'm just wondering how i'd go about upgrading the postgres version. I havn't done any upgade work before so I'm don't want to lose data.
docker-compose file
postgres:
image: postgres:11.5
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
env_file:
.docker.env
You can use pg_dumpall command for upgrading eg 11.x to 12.x:
docker exec -it <your-old-postgres-container-id> /usr/bin/pg_dumpall -U <postgres-username> backupfile #postgres-username='postgres'
ocker exec -it <new-postgres-container-id> psql < backupfile
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.