Painted-Fox / docker-postgresql

A dockerfile that produces a docker image that runs postgresql.
MIT License
72 stars 57 forks source link

Root / postgres default password #2

Closed adrianlzt closed 10 years ago

adrianlzt commented 10 years ago

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!

Painted-Fox commented 10 years ago

It's not a silly question at all, but something I've neglected to implement yet. For my docker-mariadb project, I have it set so that the default superuser is named docker and the password is also docker. You can see this here: https://github.com/Painted-Fox/docker-mariadb/blob/master/start.sh#L32

However, I would like to make it so that every time you create a new container, a new password is generated at random. Then I will have this echoed out so running docker logs container_name will show you the superuser password. I think that would be more secure. Do you have any suggestions on this?

I was focusing on getting docker-php5-stack to work first, so this project hasn't had the attention it needs in a while.

adrianlzt commented 10 years ago

Ok. I cannot help, I'm a newie in Docker and Postgres.

But I make a workaround:

$ sudo docker run -p 5432:5432 -v /tmp/postgresql:/data -t -i -entrypoint="/bin/bash" paintedfox/postgresql -i
root@88104f91d6fa:/# ./start.sh &
root@88104f91d6fa:/# su postgres -c psql
postgres=# create user adri password 'adri';
postgres=# create database adri;
exit container
sudo docker run -d -p 5432:5432 -v /tmp/postgresql:/data paintedfox/postgresql

Connect from the host $ psql -U adri -h localhost -W

sheerun commented 10 years ago

This was an issue for me too.

Painted-Fox commented 10 years ago

Okay. I updated docker-postgresql to catch up on a lot of improvments made to docker-mariadb in commit aeed837. Let me know if this solves your issue.

adrianlzt commented 10 years ago

Thanks!