I have the following container:
admin@PC:/$docker ps -a
returns
CONTAINER ID | IMAGE | COMMAND | CREATED | STATUS | PORTS | NAMES |
---|---|---|---|---|---|---|
9c0adfffff | hg/sample:1.1 | "/usr/sbin/init" | 8 days ago | Up 7 days | 0.0.0.0:80->80/tcp, :::80->80/tcp | agitated_euclid |
This container is a springboot webapp, that maps the application on 80:80. So, the problem is how to access the postgresql that is used by this application inside the same docker container to be accessible from:
- the host linux machine containing the docker with this container? and,
- any computer with pgadmin interface to connect to this docker postgresql?
Currently I'm using sudo docker exec -it 9c0adfffff bash
command to connect to the docker terminal and accessing database using psql
, but that doesn't satisfy my current requirement. (like this)
I also tried docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres
from this answer, but I think this fires up the new container, and also that is not what I need. I need to access database of existing container, whose webapp is running on port 80 currently.