5

So what i did is:

docker run -d -e POSTGRES_USER=user -e POSTGRES_PASSWORD=456789 --name admin-service -p 5432:5432  postgres

and when i check with docker ps and docker inspect

"Networks": {
              ...
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
              ...
             }
  }

and docker ps:

CONTAINER ID   IMAGE      COMMAND                  CREATED          STATUS          PORTS                    NAMES
6f1b75bed5b1   postgres   "docker-entrypoint.s…"   18 minutes ago   Up 18 minutes   0.0.0.0:5432->5432/tcp   admin-service

i went to PgAdmin and try to connect with host: 172.17.0.2, i get connection time out, so i change hostname to localhost, it keep saying password authentication failed, i filled username and password as above. So i have no idea what i did wrong here.

2
  • If your pgadmin is running on the docker host, then you should be able to connect at localhost port 5432. Commented Jun 10, 2022 at 7:52
  • i've tried that, and it keep warning that i failed to authenticate, i use user as username and 456789 as password Commented Jun 10, 2022 at 8:18

1 Answer 1

9

found the problem, just change to another port, and it worked.

docker run --name admin-service -e POSTGRES_PASSWORD=456789 -p 8001:5432 -d postgres
Sign up to request clarification or add additional context in comments.

2 Comments

I got an error that says my db is used already docker: Error response from daemon: Conflict. The container name "/crowd_db_1" is already in use by container "fcba543286ee3f34a1ca9ba2b63469c44f2e2f87ca4fc20c14c55ce64901422c". You have to remove (or rename) that container to be able to reuse that name.
@Peoray you need to remove the previously created container that already use the name crowd_db_1 in order to recreate it. So first terminate the container then delete it ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.