Search code examples
postgresqldockerdocker-desktop

psql: illegal option -- user=postgres


I have launched a postgres docker container using:

docker run -d -e POSTGRES_PASSWORD=x -p 5432:5432 
registry.gitlab.com/dalibo/postgresql_anonymizer

and then trying to connect it using:

set PGPASSWORD=x
psql --host=localhost --port=5432 --user=postgres

But,when i am trying it to connect it using the above commands on the Windows cmd, it is throwing error:

C:\Program Files\Docker\Docker>psql --host=localhost --port=5432 --user=postgres
psql: illegal option -- user=postgres
Try "psql --help" for more information.

Thank you in advance.


Solution

  • Use the option --username=USERNAME as described by psql --help and the manual