Re: postgres and initdb not working inside docker - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: postgres and initdb not working inside docker
Date
Msg-id CAKFQuwZ5wqhKtL1whU2e2h17isT6gLdZQVyBXmhoWNzW_OppQA@mail.gmail.com
Whole thread Raw
In response to Re: postgres and initdb not working inside docker  (Roffild <roffild@hotmail.com>)
List pgsql-hackers
On Sat, May 28, 2022 at 9:35 AM Roffild <roffild@hotmail.com> wrote:
Docker is now the DevOps standard. It's easier to build an image for
Docker and run the site with one command.

But the volume mount has a limitation with chmod 755. I don't want to
write the database directly to the container.

The container is isolated from everything. Therefore, checking the file
permissions inside the container is meaningless. And writing to the
container is also a "security hole".

The world has changed! And the old standards don't work...


Given the general lack of clamoring for this kind of change I'd be more inclined to believe that your specific attempt at doing this is problematic rather than there being a pervasive incompatibility between Docker and PostgreSQL.  There is a host environment, a container environment, multiple ways to expose host resources to the container, and the command line and/or docker file configuration itself.  None of which you've shared.  So I think that skepticism about your claims is quite understandable.

My suspicion is you aren't leveraging named volumes to separate the container and storage and that doing so will give you the desired separation and control of the directory permissions.

Based upon my reading of:


and limited personal experience using Docker, I'm inclined to believe it can be made to work even if you cannot do it exactly the way you are trying right now.  Absent a use case for why one way is preferable to another having the bar set at "it works if you do it like this" seems reasonable.

David J.

pgsql-hackers by date:

Previous
From: Roffild
Date:
Subject: Re: postgres and initdb not working inside docker
Next
From: Feike Steenbergen
Date:
Subject: Re: postgres and initdb not working inside docker