I am a beginner to Docker, and I would like to know how can I create a Docker image of my existing postgresql database?
1 Answer
Your best bet is to pull the standard, preconfigured Postgres image (of the appropriate version) from Docker Hub. Set it up with a volume for storing the database. Use pg_dump to export your existing database, and pg_restore to the new one.
2 Comments
Bionix1441
sorry for the stupid question, do I need an image of my linux pc or of postgresql?
y6nH
The Postgresql Docker image contains a stripped-down Linux system with a Postgres server. You don't need to make any image yourself, just use the official one. The page linked above has good instructions.