I have a PostgreSQL container inside vmware(which Debian is the OS). I want to connect to PostgreSQL through pgAdmin in my host (windows 10)
I tried to get the IP address of container by using inspect flag but windows could't ping that address.
what should I do ?
You need to make sure you've started the container with a published port
docker run -p 5432:5432 -v pgdata:/var/lib/postgresql/data -d --name db postgres
and then you can access it through the VM's IP address
export PGHOST=10.20.30.40 # the VM's IP address
export PGPORT=5432 # the first `docker run -p` port number (5432 is the default)
psql mydb
The docker inspect
IP address is useless in this configuration and many other common setups; never look it up.