Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Set an explicit username and password for the db service #159

Merged
merged 3 commits into from
Feb 19, 2020
Merged

Set an explicit username and password for the db service #159

merged 3 commits into from
Feb 19, 2020

Conversation

azlyth
Copy link
Contributor

@azlyth azlyth commented Feb 16, 2020

Issue that this addresses

The official Postgres image pushed a change that will prevent a fresh database from initializing without a password.

Trying to start with an empty db volume results in this error from the db container:

db        | Error: Database is uninitialized and superuser password is not specified.
db        |        You must specify POSTGRES_PASSWORD for the superuser. Use
db        |        "-e POSTGRES_PASSWORD=password" to set it in "docker run".
db        |
db        |        You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections
db        |        without a password. This is *not* recommended. See PostgreSQL
db        |        documentation about "trust":
db        |        https://www.postgresql.org/docs/current/auth-trust.html

Solution

  • Explicitly set the default Postgres username and password to postgres via environment.
  • Set the new Postgres password in each service's configuration.

@BretFisher
Copy link
Collaborator

LGTM, but didn't test.

@mikesir87
Copy link
Member

Just tested it and it works for me. Only suggestion would be to update the other docker-compose-* files so they still work too.

@mikesir87
Copy link
Member

Ah! Should have included the docker-swarm-* files too. After that, should be ready to merge.

@mikesir87
Copy link
Member

Alrighty. LGTM. Feel free to merge @jrburcio 👍

@jrburcio jrburcio merged commit 245c8f3 into dockersamples:master Feb 19, 2020
@azlyth azlyth deleted the fix-postgres-init branch February 19, 2020 21:14
@sparrowt
Copy link

These changes seem to have broken the 'Getting Started' instructions such that step 4 (swarm) of this guide no longer works:
https://www.docker.com/docker-desktop/getting-started-for-windows

This is quite off-putting for potential new folks trying out Docker, @azlyth is there any chance you or someone else with permission could update the images? (which is apparently what needs doing according to this comment) in order to address #165 and #162?

Many thanks in advance

@azlyth
Copy link
Contributor Author

azlyth commented Sep 30, 2020

Hey @sparrowt, I unfortunately don't have the access to do that. Perhaps someone on the Docker team can look into fixing?

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

Successfully merging this pull request may close these issues.

5 participants