3

I started a postgres docker container using

sudo docker run --name some-postgres -d postgres

and then attempted to connect to it using

sudo docker run -it --rm --link some-postgres:postgres postgres psql -h postgres

which gives the error psql: FATAL: role "root" does not exist

These commands are exactly the same as the ones listed on the docker hub page Only run as root and without -e POSTGRES_PASSWORD=mysecretpassword

Have I done something wrong here? What could be causing this?

2
$ docker run --rm --name some-postgres -d postgres
cb2ddbb0f4f715077ebc1bfc2dc7151e5a6d07cd374c28be1db6d6ad77b9b16a

$ docker run -it --rm --link some-postgres:postgres postgres psql -h postgres -U postgres
psql (10.4 (Debian 10.4-2.pgdg90+1))
Type "help" for help.

postgres=#

You forgot the -U postgres

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.