How to Get the IP Address of a Docker Container


If you need to get the IP Address of a Docker Container, then you can do the following:

Option 1 – Connect to the Bridge Network

Find out the network setup:

docker network ls

Create a docker container and assign it to the bridge network:

docker run -dt <nginx>

Get the information about the container:

docker ps

Inspect the network:

docker network inspect bridge

Now you can see the container IP Address.

Option 2 – Use docker inspect

Use the container id to get detailed information:

docker inspect abcde1234567