Re: postgres and initdb not working inside docker

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Roffild <roffild(at)hotmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: postgres and initdb not working inside docker
Date: 2022-05-28 17:11:27
Message-ID: CAKFQuwZ5wqhKtL1whU2e2h17isT6gLdZQVyBXmhoWNzW_OppQA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, May 28, 2022 at 9:35 AM Roffild <roffild(at)hotmail(dot)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:

https://github.com/docker-library/docs/blob/master/postgres/README.md

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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Feike Steenbergen 2022-05-28 17:12:38 Re: postgres and initdb not working inside docker
Previous Message Roffild 2022-05-28 16:34:58 Re: postgres and initdb not working inside docker