On Sat, Mar 12, 2022 at 07:24:26PM -0700, David G. Johnston wrote:
>
> Though I am curious that initdb didn't fail during the build since it
> doesn't seem like either -D or PGDATA have been set and one of those is
> required. I suppose it ended up using an unexpected location that didn't
> match up with the -D option to pg_ctl.
If you look a few lines above the link I sent you can see the PGDATA env being
set to the same location. The problem is only that this location is a volume.
> It is indeed possible to do what you are trying - to bake in an active
> database into the docker image, and not rely on a separate mounted volume
> for the database. But that also isn't really how the existing image is
> setup to be used and so you will need to figure out the customizations
> needed to make it do what you want
Also using the container layer to write data will perform ridiculously bad. If
the goal is only to read the data that might be ok, but maybe not. I think the
OP should better ask on Docker specific lists for guidance.