Reputation: 21
I'm extending the postgres image with an argument POSTGRES_PASSWORD=postgres so that my derived container would already have a default password using docker build with dockerfile.
Whenever I ran psql -U postgres
on the container from the derived image i made from postgres, I get:
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"?
On my DockerFile I have:
ARG POSTGRES_PASSWORD=postgres
FROM postgres:alpine
RUN apk add --update nodejs
RUN apk add --update npm
RUN apk add --update erlang
RUN apk add --update elixir
CMD ["/bin/bash"]
then I ran
docker build -t myImage .
docker run --name sample -d -it myImage
docker exec -it sample bash
I want to run psql -U postgres
on sample
container (image extended from postgres).
Upvotes: 1
Views: 1503
Reputation: 463
Try to replace ARG POSTGRES_PASSWORD=postgres
by ENV POSTGRES_PASSWORD postgres
The postgres docker image documentation state that this parameter is an Environement Variable, so this might help.
Upvotes: 2