From: Bernd Graf <gbernd@gmx.de>
To: pgsql-general@lists.postgresql.org
Subject: Filled Postgres server as Docker image
Date: Fri, 5 Jan 2024 11:31:34 +0100
Message-ID: <b0a061b5-f133-41ff-822f-cd06c82b5963@gmx.de> (raw)
Hi,
for development and testing (integration testing) I want to have a
Docker image with a pre-filled Postgres database. It should be a simple
and quick task to spin-up this database, e.g., in a docker compose setup.
Suggested solutions to achieve this goal are
(1) To place initialization scripts at /docker-entrypoint-initdb.d and
do the filling of the DB when the container is started the first time ->
I want to avoid this, as it takes 20 minutes
(2) To mount a volume to /var/lib/postgresql and have the data there ->
I want to avoid this, as it requires to move and maintain the data
folder separately
Not suggested (at least this is what I found at mailing lists and at
StackOverflow) is to burn the data into the container image. However,
the reasons that are mentioned in these discussions "data is gone when
the container is gone ..." is not my concern.
As it is not easy to write a Docker build to achieve my goal, I would
like to ask if there are reference projects / Docker build processes
that perform this workflow? Reason why I consider it as not too easy: I
have to manually start the Postgres server ignoring the intended
entry-point script and then fill it with my data.
Looking forward to your comments/suggestions!
Bernd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: gbernd@gmx.de
Subject: Re: Filled Postgres server as Docker image
In-Reply-To: <b0a061b5-f133-41ff-822f-cd06c82b5963@gmx.de>
References: <b0a061b5-f133-41ff-822f-cd06c82b5963@gmx.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox