Skip to content

Creation multiple users and databases #240

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 7 commits into from

Conversation

xtimon
Copy link

@xtimon xtimon commented Dec 20, 2016

Execute for test:
docker run --name some-postgres -p 5432:5432 -e POSTGRES_USERS="user1:user1pass|user2:user2pass|user3:user3password" -e POSTGRES_DATABASES="database1:user1|database2:user2|database3:user3" -e POSTGRES_CONFIGS="work_mem:15MB|fsync:off|full_page_writes:off" -d xtimon/postgres

@gmile
Copy link

gmile commented Jul 7, 2017

Is there anything to be done before this is merged? In case there's a reason this is not going to be merged – what is the official / proper way for adding new users / databases?

@yosifkit
Copy link
Member

yosifkit commented Jul 10, 2017

Related issues: docker-library/mysql#213, docker-library/mysql#86, docker-library/mysql#18, MariaDB/mariadb-docker#63, MariaDB/mariadb-docker#15.

So, the answer is to just put scripts in /docker-entrypoint-initdb.d/:

@yosifkit yosifkit closed this Jul 10, 2017
@xtimon
Copy link
Author

xtimon commented Jul 10, 2017

The official way for adding new users / databases is the same. I didn't broke it. All the environments POSTGRES_PASSWORD, POSTGRES_USER, POSTGRES_DB work as expected.

@Miesvanderlippe
Copy link

@yosifkit
The init script doesn't really solve my issue. Databases and usernames can be static but I'd much rather have random passwords which I can pass to my other containers.

Now I get I'd be able to generate a script before calling docker compose, but having it be more integrated would be nicer. I want to pass some Docker-compose variables to the DB which this PR would enable.

I also get you're annoyed having to answer similar questions all the time, but this PR is very much different from anything you're linking and solves a different problem. I hope you can look at it from my perspective and re-evaluate the value of this PR.

@tianon
Copy link
Member

tianon commented Apr 10, 2020

The point @yosifkit is making is that this PR can be implemented entirely as a drop-in script in /docker-entrypoint-initdb.d, and as such we'd rather not add additional behavior to an already overly complex initialization script we maintain as a delta over what upstream provides.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants