You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running docker run --rm postgres:9.5.20-alpine, the database successfully starts up, but with docker run --rm postgres:9.5.21-alpine, I get this output instead:
Error: Database is uninitialized and superuser password is not specified.
You must specify POSTGRES_PASSWORD for the superuser. Use
"-e POSTGRES_PASSWORD=password" to set it in "docker run".
You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections
without a password. This is *not* recommended. See PostgreSQL
documentation about "trust":
https://www.postgresql.org/docs/current/auth-trust.html
Is this an expected change?
Reacted by Alex Engelberg, Levi Cole, Lukasz Jagiello, MohammadMasoumi, David Burke, ejose19, b-jam, Sam Dickinson, Simon Roberts, Hidetaka Okita and 81 more
Based on 42ce743 it seems like it's intentional, but I find it odd to change something like that on a minor release
Reacted by Alex Schokking, Levi Cole, Herman J. Radtke III, peter cresswell, Cathal, MohammadMasoumi, Ricardo Amendoeira, Dennis Schwertel, Peter Dekkers, b-jam and 36 more
Reacted by Dennis Schwertel, Jean-Adrien Vaucher, Will Vincent, Joel Courtney, William Hua, Andrea Rizzello, bcb, Chan-Ho Suh, Kaka Ruto and Apoorva Srivastava
I just observed the same issue when bumping 9.6.16 => 9.6.17.
Reacted by Alex Schokking, Levi Cole, Lukasz Jagiello, Sergey Katsubo, MohammadMasoumi, David Martinez Barreiro, Naoto Koshikawa, anveshagarwal, Paul Vorbach, Mateusz Bełczowski and 11 more
We were convinced to make it more secure by default and were aware that this would break some users. Apologies for breaking changes. 🙇♂️ We felt that the increased security out-weighed the breakage. See #658 and #580.
If you know that you want to be insecure (i.e. any one can connect without a password from anywhere), then POSTGRES_HOST_AUTH_METHOD=trust is how you opt in to that.
We really recommend setting a password and it was really a bad decision by me in the beginning to continue to allow running the database without a password (#31 (comment) & #36)
Reacted by Masato Ohba, YC Yap, Nk, Florian Ebeling, Federico Bond, Mark Waite, Mike Shade, Jason B., Jannis Vajen, Zino and 19 more
Reacted by Anderson Silva, Alexander Lyon, hrmny, Jonas Erlandsson, todd densmore, Simon Tabor, Christian Jeffries, Garis, decomorreno, Łukasz Samson and 60 more
Reacted by Charlie Denton, Tianon Gravi, Florian Ebeling, Tyler Cosgrove, Hussain Parsaiyan and Igor Konforti
Reacted by deepj, Franti, Tyler Cosgrove and Lucifer
Reacted by Valentin Ivanov, Shloka Pandya, Hunter Barrington, Madhav Narayan, Igor Konforti, Chan-Ho Suh, cindyliu923 and asd123ea
I wish a breaking change was not pushed out on a Friday. This broke our CI/CD pipeline, which I had to fix on a Saturday.
Reacted by Brock McElroy, Alex Viscreanu, Minghang Chen, Lukasz Jagiello, Dan Jacob, Sergey Katsubo, Arisah Ijeoma, ankit-gojek, David Burke, Krzysztof Knapik and 177 more
Reacted by Andrea Rizzello, Denys Parchenko, Isaiah King'ori, lilypytel-toast, Chan-Ho Suh, Jaanus Varus, Elian Daiva, CHUNG-CHIA CHENG, Wotori Movako and Apoorva Srivastava
Reacted by MohammadMasoumi, Dennis Schwertel, Kartik Gupta, Alexandre Sicard, Dimitar Venov, Jean-Adrien Vaucher, hrmny, todd densmore, Alexis Jacob, decomorreno and 19 more
Reacted by Kris Barkar, lilypytel-toast, Melvin Lammerts and Stuart Axon
As always emotions fly high when a breaking change is introduced, causing work for others ;)
I appreciate the effort that you put into maintaining this image!
Maybe one can put the fix to add "POSTGRES_HOST_AUTH_METHOD=trust" somewhere more prominent. I get it that its part of the docker output when you start the image, yet sadly not if you start it with "-d". Then you are just wondering why the next docker command complains that the database is not up ;)
Reacted by Kevin L. and Vladimir Gritskevich
Reacted by Andy Kish, Timothy Washington, radoslavpetranov, Matt Babineau, Jannis Vajen, Michal Kreft, nezir, Kevin L., Chan-Ho Suh and David Alejandro
(Of course, these articles and examples will need to be updated, since they no longer work as shown.)
I don't understand exactly how these pipelines actually configure and start the Postgres service in docker. So I don't know where the -e POSTGRES_PASSWORD=password would go.
And to be honest, I don't fully understand exactly what POSTGRES_HOST_AUTH_METHOD=trust does either since it's the first time I'm seeing it. I can probably figure it out in a few hours, but y'know, it's the long weekend. I got family to take care of, out of town guests visiting, housework to do, shopping to do, don't got time to spend on this...
Reacted by Kenneth Teh, Tom, Jean-Pierre Levac, Étienne BERSAC, Handell, esquaredly and Konstantin Moseyko
Was or is there consideration to switch to something like semantic versioning? If that was the case then this change, given it's intentional and a breaking changes, would cause a major revision change and everyone could deal with it accordingly. If such a change comes through not as a major, not even as a minor but merely as a patch release (z in x.y.z), then it is highly surprising and that is what trips up processes. Just putting it out there for consideration.
Reacted by Alexandre Sicard, Clayton R. Mendonça, hrmny, todd densmore, Sam Dickinson, Christian Jeffries, Ian MacDonald, Marcelo, Kaiden Rawlinson, Mike Dite and 22 more
We were just burnt by this change and would give a big +1 to adopting semver to help mitigate this in the future.
However, I'm not posting just to pile on about semver, I have one other thing I'd like to point out. When our CI pipelines starting running with this newer container image (without POSTGRES_HOST_AUTH_METHOD or POSTGRES_PASSWORD) set the postgres container looked like it was coming up and staying up correctly. Because it wasn't clear the postgres container was the issue we spent a lot of time and effort looking in the wrong place.
In future, if a change is made where the database effectively doesn't work, the container should not just sit there happily doing nothing when it's actually broken. Had the postgres container been more noticeably broken we could have saved most of the time and effort we spent looking in the wrong place for the cause of the issue.
As a slight aside, is there an official we can monitor to know about future significant or breaking changes to this container in future?
Reacted by Nathan Broadbent, Michal Čihař, Gavin, Dan Jacob, Stuart Harrison, Clayton R. Mendonça, Chris Meurer, hrmny, todd densmore, Jeff Sholl and 21 more
Not sure if this will help anyone and I apologize if this is the wrong place to post this, but here is how I solved the issue without having to set POSTGRES_HOST_AUTH_METHOD: trust (which was not recommended above)
No idea why setting POSTGRES_HOST_AUTH_METHOD=trust doesn't work for me. 🤔
I got PG::ConnectionBad: FATAL: password authentication failed for user "postgres" when I tried to rake db:migrate.
I had to set a password and added POSTGRES_PASSWORD=password to my docker-compose.yml.
trust authentication is appropriate and very convenient for local connections on a single-user workstation.
Is there a way to suppress the warning about trust in this situation? As mentioned, we limit this to local workstations, we'd like to avoid showing the error unnecessarily.
I think note, that "POSTGRES_HOST_AUTH_METHOD='trust' is not recommended" only actual if you have forward postgre post from your container to outside.
If your service works only in docker network (no port forward specified in docker-compose file) I think it's pretty safe to trust anything from local docker network
Activity
vpzomtrrfrt commentedon Feb 14, 2020
Based on 42ce743 it seems like it's intentional, but I find it odd to change something like that on a minor release
aengelberg commentedon Feb 14, 2020
I just observed the same issue when bumping
9.6.16=>9.6.17.vpzomtrrfrt commentedon Feb 14, 2020
See also #658, the PR that seems to have introduced this
yosifkit commentedon Feb 14, 2020
We were convinced to make it more secure by default and were aware that this would break some users. Apologies for breaking changes. 🙇♂️ We felt that the increased security out-weighed the breakage. See #658 and #580.
If you know that you want to be insecure (i.e. any one can connect without a password from anywhere), then
POSTGRES_HOST_AUTH_METHOD=trustis how you opt in to that.We really recommend setting a password and it was really a bad decision by me in the beginning to continue to allow running the database without a password (#31 (comment) & #36)
bxparks commentedon Feb 15, 2020
I wish a breaking change was not pushed out on a Friday. This broke our CI/CD pipeline, which I had to fix on a Saturday.
Postgres is no longer starting
CloudArchipelago commentedon Feb 16, 2020
Where in a CI/CD pipeline does one place those lines
-e POSTGRES_PASSWORD=passwordorPOSTGRES_HOST_AUTH_METHOD=trust?chickahoona commentedon Feb 16, 2020
As always emotions fly high when a breaking change is introduced, causing work for others ;)
I appreciate the effort that you put into maintaining this image!
Maybe one can put the fix to add "POSTGRES_HOST_AUTH_METHOD=trust" somewhere more prominent. I get it that its part of the docker output when you start the image, yet sadly not if you start it with "-d". Then you are just wondering why the next docker command complains that the database is not up ;)
POSTGRES_PASSWORD is now required when using postgres via docker
bxparks commentedon Feb 16, 2020
@CloudArchipelago: It depends on what pipeline you are using. The two that I'm familiar with is GitHub and BitBucket:
POSTGRES_HOST_AUTH_METHOD=trustin theenvsection shown here: https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.ymlenvironmentsection shown here: https://community.atlassian.com/t5/Bitbucket-questions/How-do-I-use-Postgres-in-Bitbucket-Pipelines/qaq-p/461910(Of course, these articles and examples will need to be updated, since they no longer work as shown.)
I don't understand exactly how these pipelines actually configure and start the Postgres service in docker. So I don't know where the
-e POSTGRES_PASSWORD=passwordwould go.And to be honest, I don't fully understand exactly what
POSTGRES_HOST_AUTH_METHOD=trustdoes either since it's the first time I'm seeing it. I can probably figure it out in a few hours, but y'know, it's the long weekend. I got family to take care of, out of town guests visiting, housework to do, shopping to do, don't got time to spend on this...ManfredLange commentedon Feb 17, 2020
Was or is there consideration to switch to something like semantic versioning? If that was the case then this change, given it's intentional and a breaking changes, would cause a major revision change and everyone could deal with it accordingly. If such a change comes through not as a major, not even as a minor but merely as a patch release (z in x.y.z), then it is highly surprising and that is what trips up processes. Just putting it out there for consideration.
kennethteh90 commentedon Feb 17, 2020
Tried @bxparks proposed workaround for our CircleCI build (we use Github) and it worked. Simply add
POSTGRES_HOST_AUTH_METHOD: trust.Nadock commentedon Feb 17, 2020
We were just burnt by this change and would give a big +1 to adopting semver to help mitigate this in the future.
However, I'm not posting just to pile on about semver, I have one other thing I'd like to point out. When our CI pipelines starting running with this newer container image (without
POSTGRES_HOST_AUTH_METHODorPOSTGRES_PASSWORD) set thepostgrescontainer looked like it was coming up and staying up correctly. Because it wasn't clear thepostgrescontainer was the issue we spent a lot of time and effort looking in the wrong place.In future, if a change is made where the database effectively doesn't work, the container should not just sit there happily doing nothing when it's actually broken. Had the
postgrescontainer been more noticeably broken we could have saved most of the time and effort we spent looking in the wrong place for the cause of the issue.As a slight aside, is there an official we can monitor to know about future significant or breaking changes to this container in future?
scaytrase commentedon Feb 17, 2020
Same here, broken our CI and local development
CI: Fix postgres configuration on Drone
64 remaining items
Ble offer for en breaking change i postgres docker imaget
Fikset oppsettet av lokal docker
Update postgres env vars in Docker compose due to this issue.
Allow postgres container to start without password
Allow postgres container to start without password
Fix starting database without password
circle-ciのpostgresコンテナのエラーを修正した
Fix CI failure from Docker Postgres image
cheesepaulo commentedon Mar 4, 2020
Works for me adding this to postgres container.
environment: POSTGRES_HOST_AUTH_METHOD: "trust"khiav223577 commentedon Mar 6, 2020
@QuantumWaver
It works for me. Thanks!
No idea why setting
POSTGRES_HOST_AUTH_METHOD=trustdoesn't work for me. 🤔I got
PG::ConnectionBad: FATAL: password authentication failed for user "postgres"when I tried torake db:migrate.I had to set a password and added
POSTGRES_PASSWORD=passwordto mydocker-compose.yml.babakks commentedon Mar 7, 2020
@yosifkit I've submitted a PR in which updated the docs and put more emphasis on how to aptly set the environment variables. Merge it as you deem fit.
mikemaccana commentedon Mar 13, 2020
Per https://www.postgresql.org/docs/current/auth-trust.html:
Is there a way to suppress the warning about
trustin this situation? As mentioned, we limit this to local workstations, we'd like to avoid showing the error unnecessarily.ShockwaveNN commentedon Mar 24, 2020
I think note, that "
POSTGRES_HOST_AUTH_METHOD='trust'is not recommended" only actual if you have forward postgre post from your container to outside.If your service works only in docker network (no port forward specified in docker-compose file) I think it's pretty safe to trust anything from local docker network
bfirsh commentedon Apr 2, 2020
I tripped up on this too. It looks like it has broken Compose getting started guides too: https://docs.docker.com/compose/django/
amotalles commentedon Oct 15, 2021
I solved my issue using below:
- POSTGRES_HOST_AUTH_METHOD=md5
- POSTGRES_INITDB_ARGS=--auth-host=md5