Is there a command I can run to get the container\'s IP address right from the host after a new container is created?
Basically, once Docker creates the container, I
Execute:
docker ps -a
This will display active docker images:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3b733ae18c1c parzee/database "/usr/lib/postgresql/" 6 minutes ago Up 6 minutes 5432/tcp serene_babbage
Use the CONTAINER ID value:
docker inspect | grep -w "IPAddress" | awk '{ print $2 }' | head -n 1 | cut -d "," -f1
"172.17.0.2"