1
votes

i have two docker containers running, following the instructions given here: https://github.com/swri-robotics/bag-database.

I can now look at the database in the browser using: localhost:8080, so it's set up properly and running fine.

So my question is, how can I get the other container that is running on port 5432 to list the database with all the other databases that I have locally using psql - l? Right now I can only look at it if I open the container first.

I run it like this:

docker run -d -p 5432:5432 --name bagdb-postgres -v /var/lib/bagdb-postgres:/var/lib/postgresql/data -h 127.0.0.1 -e POSTGRES_PASSWORD=password -e POSTGRES_USER=user -e POSTGRES_DB=bag_database mdillon/postgres:lastest

Thanks!

1

1 Answers

0
votes

The programm is executed in a container. The intention of containers is to create a environment capsuled off your host operating system. You added some flags like -p and -v which define some connections between the host and the container. These are the only connections you have and you can use docker commands to connect to your container. It is not intended that you can execute code inside a container as if it was not inside a container. It is not exposed to your operating system and as far as I know there is no way to change that.