Re: BUG #17436: Initializing and starting with Dockerfile fails

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: dkeate(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17436: Initializing and starting with Dockerfile fails
Date: 2022-03-13 02:04:38
Message-ID: 20220313020438.gtdvqt7osxe37bi3@jrouhaud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On Sat, Mar 12, 2022 at 11:40:28PM +0000, PG Bug reporting form wrote:
>
> Dockerfile contents:
>
> FROM postgres
> USER postgres
> RUN initdb
> RUN pg_ctl -D /var/lib/postgresql/data -l /var/lib/postgresql/data/logfile
> start
> RUN pg_restore --dbname=dvdrental --create --verbose /var/dvdrental.tar
>
> executing 'docker build .' throws the following error:
>
> Step 4/5 : RUN pg_ctl -D /var/lib/postgresql/data -l
> /var/lib/postgresql/data/logfile start
> ---> Running in 8561ab2addbe
> pg_ctl: directory "/var/lib/postgresql/data" is not a database cluster
> directory
>
> However, starting a new container and running identical commands works.
>
> docker run -it postgres sh
> gosu postgres sh
> initdb
> pg_ctl -D /var/lib/postgresql/data -l /var/lib/postgresql/data/logfile
> start
> waiting for server to start.... done
> server started
>
> To me, these are identical processes, but I may be wrong because docker is
> docker.
>
> There are no volumes attached. These are the only instructions and I
> couldn't distill this problem any farther. These are the only commands I am
> giving. Something is changing in the intermediate images, somehow.

This is not a postgres bug. That being said, according to
https://github.com/docker-library/postgres/blob/master/Dockerfile-debian.template#L192
the target directory is a volume, so that can't work at build time.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2022-03-13 02:24:26 Re: BUG #17436: Initializing and starting with Dockerfile fails
Previous Message PG Bug reporting form 2022-03-12 23:40:28 BUG #17436: Initializing and starting with Dockerfile fails