Closed
Description
I'm trying to use this as a base image, and set different databases and users in my Dockerfile, but am having trouble accessing the files in mounted as VOLUME
. Here's what I have:
Dockerfile
FROM postgres
VOLUME /var/lib/postgresql/data
ADD setup_db.sh /code/
RUN /code/setup_db.sh
setup_db.sh
#!/bin/bash
gosu postgres postgres
createdb mydb
# createuser myrole
# postgres stop
But when I try to build my image I get:
$ docker build --tag="pgdock" .
Sending build context to Docker daemon 17.92 kB
Sending build context to Docker daemon
Step 0 : FROM postgres
---> 2f007d4a5aa5
Step 1 : VOLUME /var/lib/postgresql/data
---> Using cache
---> ccfab417f4c2
Step 2 : RUN ls -l /var/lib/postgresql/data/
---> Using cache
---> c1194d442777
Step 3 : ADD setup_db.sh /code/
---> Using cache
---> d50b814fb7f9
Step 4 : RUN /code/setup_db.sh
---> Running in 233e6b4fe77b
postgres cannot access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
createdb: could not connect to database template1: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
2014/08/24 15:39:35 The command [/bin/sh -c /code/setup_db.sh] returned a non-zero code: 1
Any advice?
Metadata
Metadata
Assignees
Labels
No labels