painted-fox / docker-postgresql Goto Github PK
View Code? Open in Web Editor NEWA dockerfile that produces a docker image that runs postgresql.
License: MIT License
A dockerfile that produces a docker image that runs postgresql.
License: MIT License
Using latest image :
paintedfox/postgresql latest 283e9a149f8f 2 days ago 519.5 MB
PostgreSQL is unable to start because of missing SSL certificate file :
POSTGRES_USER=docker
POSTGRES_PASS=docker
POSTGRES_DATA_DIR=/data
Starting PostgreSQL...
Creating the superuser: docker
psql: could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Unable to create the superuser.
Retrying in 3 seconds...
2014-05-11 20:02:41 UTC FATAL: could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied
Hi, I want to report a problem that happens on my system but not on a constant base.
Sometimes the scripts are not creating correctly the user.
I have tracked down the reason of the problem to this script
wait_for_postgres_and_run_post_start_action() {
# Wait for postgres to finish starting up first.
while [[ ! -e /run/postgresql/9.3-main.pid ]] ; do
inotifywait -q -e create /run/postgresql/ >> /dev/null
done
post_start_action
}
Apparently the presence of /run/postgresql/9.3-main.pid
is not enough to identify Postgres as ready to accept connections.
I have random error and logs shows that post_start_action
before all the startup log entries are displayed.
I have also notice that the logic in this fork
https://github.com/waterlink/docker-postgresql/blob/master/scripts/first_run.sh
helps to avoid the problem.
Could you consider to change the "wait" logic?
Hi!
When I boot up the postgresql container, the super user, password and DB are not set up. The script seems to terminate right where the super user is created, therefore firstrun wont be removed as well.
I tried some things inside the container and it looks like the commands to psql are performed before the postgres server is even running. When I check the PID of postgres (using pidof postgres) right after the post_start_action() is called and before the first psql command is executed, no PID is available.
Is there a solution to wait until the postgres server is started correctly?
Best Regards,
Tobias
When I try to run the following:
docker run --name="foo" -e PASS="bar" foo
the default PASS is overridden with "bar" instead.
When I run the following:
docker run --name="foo" -e USER="bar" foo
the USER variable is still "super".
This is using ff19c5c53b9a.
Please let me know what other info would be helpful in reproducing!
Check the official docker example for postgresql (http://docs.docker.io/en/latest/examples/postgresql_service/)
Maybe is a silly question, but, which is the default superuser password?
All that I see is 'tricks' to reset the password. I have to open the image with /bin/bash and set it?
Thanks!
Hi
Ive tried setting up docker-postgresql several times, but always run into the same problem:
psql: FATAL: password authentication failed for user "super"
FATAL: password authentication failed for user "super"
I am using the generated password, and retrieve it via 'docker logs postgresql'.
I have also tried setting the password when running the container.
I have also tried
RUN echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/9.3/main/pg_hba.conf
and
RUN echo "host all all 0.0.0.0/0 ident" >> /etc/postgresql/9.3/main/pg_hba.conf
Neither worked.
Can you help?
Thanks
On boot startup.sh is spawned multiple times and it keeps hanging in a loop, here is an output of docker top
:
UID PID PPID C STIME TTY TIME CMD
root 12099 1005 0 12:45 ? 00:00:00 /usr/bin/python3 -u /sbin/my_init
root 12125 12099 0 12:45 ? 00:00:00 /usr/bin/runsvdir -P /etc/service log: ash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) bash: psql: command not found bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) bash: psql: command not found bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) bash: psql: command not found bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) bash: psql: command not found
root 12126 12125 0 12:45 ? 00:00:00 runsv postgresql
root 12127 12125 0 12:45 ? 00:00:00 runsv syslog-ng
root 12128 12125 0 12:45 ? 00:00:00 runsv cron
root 12130 12128 0 12:45 ? 00:00:00 /usr/sbin/cron -f
root 12131 12127 1 12:45 ? 00:00:02 syslog-ng -F -p /var/run/syslog-ng.pid --no-caps
root 12138 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12152 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12166 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12184 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12202 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12220 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12242 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12270 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12292 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12318 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12345 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12371 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12401 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12431 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12461 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12495 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12529 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12563 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12606 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12644 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12682 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12724 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12766 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12814 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12860 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12906 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 12952 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 13002 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 13052 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 13102 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 13156 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 13217 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 13271 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 13329 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 13393 12099 0 12:45 ? 00:00:00 /bin/bash ./run
root 13451 12099 0 12:45 ? 00:00:00 /bin/bash ./run
Logs are full of 'Unable to create the superuser. Retrying in 3 seconds...' messages.
Using the latest image (bbpsrhag7rw7a4b6nrcy5hg on Ubuntu 14.04.1/Docker 1.2.0), providing the USER environment variable seems to have no effect, and it will default to 'super'.
$ docker run -d -p 127.0.0.1:5432:5432 \
-e USER="mydbuser" -e DB="mydb" -e PASS="mypass" \
paintedfox/postgresql
b46c52755....
$ docker logs b46
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 16
POSTGRES_USER=super
POSTGRES_PASS=mypass
POSTGRES_DATA_DIR=/data
POSTGRES_DB=mydb
Initializing PostgreSQL at /data
Starting PostgreSQL...
Creating the superuser: super
2014-09-17 04:16:38 UTC LOG: database system was shut down at 2014-09-17 02:30:14 UTC
2014-09-17 04:16:38 UTC LOG: database system is ready to accept connections
2014-09-17 04:16:38 UTC LOG: autovacuum launcher started
NOTICE: role "super" does not exist, skipping
Creating database: mydb
Ability to run container as a master, slave, or public-slave (public reads only).
Docker run -e SERVER_TYPE="PUBLIC_SLAVE" ... paintedfox/postgresql
Docker run -e SERVER_TYPE="MASTER" ... paintedfox/postgresql
Docker run -e SERVER_TYPE="PUBLIC" ... paintedfox/postgresql
Planning to build this out over the weekend, but wanted thoughts first
An idea is to use the ADD command to add an authorized_keys file to the image when it is being built
I'm running this container using Vagrant. The docker logs shows me I can't start the database:
Starting PostgreSQL...
FATAL: could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied
How can I fix this?
Currently there is no way to change postgresql configuration without rebuilding the image. A suggestion is to mount a folder from host to be used as configuration folder for postgresql in the container.
near the end of the README.md, the env variable names should be changed from 3306 (mysql) to 5432 (postgres).
It seems like new cluster created with default locale instead of UTF-8:
Creating cluster with UTF-8 encoding.
Creating new cluster 9.3/main ...
config /etc/postgresql/9.3/main
data /var/lib/postgresql/9.3/main
locale C
port 5432
I'm having an issue with this image. When I run it it just looks like it's looping round and round, I can't connect to it the postgres instance.
I tried first straight from image in index and then by building manually. Initially I was on docker 0.8, but i've upgraded to 1.0.1 just in case. Same issue.
To reproduce:
mkdir -p /tmp/postgresql
sudo docker run -d --name="postgresql" \
-p 127.0.0.1:5432:5432 \
-v /tmp/postgresql:/data \
-e USER="super" \
-e DB="database_name" \
-e PASS="$(pwgen -s -1 16)" \
paintedfox/postgresql
sudo docker logs <containerId>
The logs show this repeating in a loop for ever.
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 9
POSTGRES_USER=super
POSTGRES_PASS=E6YPMC9bumy1gJAh
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Initializing PostgreSQL at /data
Starting PostgreSQL...
POSTGRES_USER=super
POSTGRES_PASS=E6YPMC9bumy1gJAh
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Starting PostgreSQL...
POSTGRES_USER=super
POSTGRES_PASS=E6YPMC9bumy1gJAh
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Quite possible i've made a silly error? How can I get more useful logs? What's going on!
I really like this postgres image, by far the best out there ๐ . It would be amazing if I could use it in my project.
When I start the container (with Vagrant) it exists wit an error code (Exited (1)
). This is what the log looks like:
POSTGRES_USER=postgres
POSTGRES_PASS=somepassword
POSTGRES_DATA_DIR=/data
POSTGRES_DATABASE=UNWDMI
Initializing PostgreSQL at /data
Starting PostgreSQL...
Creating the superuser: postgres
2014-05-08 10:12:25 UTC FATAL: could not remove old lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Operation not permitted
2014-05-08 10:12:25 UTC HINT: The file seems accidentally left over, but it could not be removed. Please remove the file by hand and try again.
Any idea what might cause this/how to fix this?
If I try to run a container using the latest image, I'm unable to connect. The connection is always refused. Any ideas? I'm doing something like this:
$ docker run -d -p 5432:5432 --name postgres -e DB=test -e USER=super -e PASS=secret paintedfox/postgresql
$ psql -h localhost -U super
Not sure if anyone else has this issue but, using the latest image, postgresql fails to start. Any help will be appreciated.
Note item two of the docker top output._
/usr/bin/runsvdir -P /etc/service log: : [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied
$ docker run -d --name="postgresql" -p 127.0.0.1:5432:5432 -v /tmp/postgresql:/data -e USER="super" -e DB="database_name" -e PASS="$(pwgen -s -1 16)" paintedfox/postgresql
$ docker logs postgresql
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 9
POSTGRES_USER=super
POSTGRES_PASS=nlMU71xfRsejnrbn
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Starting PostgreSQL...
POSTGRES_USER=super
POSTGRES_PASS=nlMU71xfRsejnrbn
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Starting PostgreSQL...
POSTGRES_USER=super
POSTGRES_PASS=nlMU71xfRsejnrbn
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Starting PostgreSQL...
POSTGRES_USER=super
POSTGRES_PASS=nlMU71xfRsejnrbn
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Starting PostgreSQL...
$ docker top postgresql
root 20549 19271 2 15:46 ? 00:00:00 /usr/bin/python3 -u /sbin/my_init
root 20578 20549 0 15:46 ? 00:00:00 /usr/bin/runsvdir -P /etc/service log: : [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied
root 20579 20578 0 15:46 ? 00:00:00 runsv postgresql
root 20580 20578 0 15:46 ? 00:00:00 runsv syslog-ng
root 20581 20578 0 15:46 ? 00:00:00 runsv cron
root 20584 20581 0 15:46 ? 00:00:00 /usr/sbin/cron -f
root 20591 20549 0 15:46 ? 00:00:00 /bin/bash ./run
root 20593 20591 0 15:46 ? 00:00:00 inotifywait -q -e create /run/postgresql/
root 20594 20580 0 15:46 ? 00:00:00 syslog-ng -F -p /var/run/syslog-ng.pid --no-caps
root 20600 20549 0 15:46 ? 00:00:00 /bin/bash ./run
root 20602 20600 0 15:46 ? 00:00:00 inotifywait -q -e create /run/postgresql/
root 20607 20549 0 15:46 ? 00:00:00 /bin/bash ./run
root 20608 20607 0 15:46 ? 00:00:00 inotifywait -q -e create /run/postgresql/
root 20614 20549 0 15:46 ? 00:00:00 /bin/bash ./run
root 20616 20614 0 15:46 ? 00:00:00 inotifywait -q -e create /run/postgresql/
root 20621 20549 0 15:46 ? 00:00:00 /bin/bash ./run
root 20622 20621 0 15:46 ? 00:00:00 inotifywait -q -e create /run/postgresql/
root 20628 20549 0 15:46 ? 00:00:00 /bin/bash ./run
root 20630 20628 0 15:46 ? 00:00:00 inotifywait -q -e create /run/postgresql/
root 20641 20549 0 15:46 ? 00:00:00 /bin/bash ./run
root 20642 20641 0 15:46 ? 00:00:00 inotifywait -q -e create /run/postgresql/
root 20648 20549 0 15:47 ? 00:00:00 /bin/bash ./run
root 20649 20648 0 15:47 ? 00:00:00 inotifywait -q -e create /run/postgresql/
root 20655 20549 0 15:47 ? 00:00:00 /bin/bash ./run
root 20656 20655 0 15:47 ? 00:00:00 inotifywait -q -e create /run/postgresql/
POSTGRES_USER=super
POSTGRES_PASS=HelloWorld
POSTGRES_DATA_DIR=/data
POSTGRES_DB=jagtran
Starting PostgreSQL...
2014-09-22 19:34:14 UTC FATAL: data directory "/data" has wrong ownership
2014-09-22 19:34:14 UTC HINT: The server must be started by the user that owns the data directory.
Fresh install, docker pull paintedfox/postgresql
and
docker run -d --name="postgresql" \
-p 127.0.0.1:5432:5432 \
-v /tmp/postgresql:/data \
-e USER="super" \
-e DB="database_name" \
-e PASS="$(pwgen -s -1 16)" \
paintedfox/postgresql
Here is the log :
POSTGRES_USER=super
POSTGRES_PASS=xxx
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Starting PostgreSQL...
Couldn't initialize inotify. Are you running Linux 2.6.13 or later, and was the
CONFIG_INOTIFY option enabled when your kernel was compiled? If so,
something mysterious has gone wrong. Please e-mail [email protected]
and mention that you saw this message.
2014-09-09 13:07:23 UTC FATAL: could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.