How to Find the IP Address of a Docker Container?

Network administrators in the Docker world have a significant obligation to learn the network components included in virtualization platforms such as Microsoft, Red Hat, and others. However, installing a container is not that much easy; appropriately configuring a container architecture necessitates strong networking expertise.

Docker networking was created to address this problem. A Docker network defines a connectivity trust zone in which containers in that network can communicate freely. Each network has its bridge interface on the host, and communication between these interfaces is filtered using firewall rules. Containers in a zone with almost the same Docker network and host bridging interface can often communicate with one another.

Docker manages IP addresses for containers running on a single host, but it has no visibility into managing IP addresses across several servers in a container cluster. Single container settings are uncommon in real-world companies. They usually have virtual machines and real hosts as well. As a result, IP addresses must be managed holistically across the enterprise.

Every Docker networking the container joins to allocate an IP address by default. And each network is given a default subnet mask, which is later used as a pool to distribute IP addresses. In the tutorial below, we are going to tell you the method to check the IP address of a docker container.


To check the IP address of a docker container, make sure that you have installed docker in any of your desired operating systems. In our case, we are implementing this method on Ubuntu 20.04 Linux system.

Method to check the IP address of a docker container

To check the IP address of a docker container, you have to open the terminal of the Ubuntu 20.04 system. You can open it by using “Ctrl+Alt+T” or by searching it in the application area. Once opened, follow the following listed steps.

Step 1: Docker interfaces

We are all aware that we can use Docker to execute our application in a bundled environment called a container. Whenever you want containers to communicate with one another, you can suppose the network they build is a bridge network. To retrieve a list of networks, type the following listed command in the terminal:

$ docker network ls

This command demonstrates the Docker-designed networks which are not detachable. The result displays the container networks that are generated during a regular Docker installation. As you can view, each network has its ID and NAME. A single driver is assigned to each network.

It’s worth noting that the “bridge” and “host” networks have almost the same name as their respective drivers. The bridge network is linked to the bridge driver, as shown in the output above.

It’s vital to remember that the network and the driver are not the same things. The network and the driver in this illustration share the same name, and they’re not the same thing. The bridge network is also screened locally, as shown in the result above.

This specifies that the network is limited to this Docker host. This is true for all bridge-based networks, as the bridge driver only allows for single-host networking.

Step 2: Check Container Features

Now you have to obtain either the ID or the name of the container. You can use the following listed command to achieve this:

$ docker ps

In the output, the ID and the name of the containers are displayed. You can use them in further steps.

Step 3: Using the bash

You may also acquire the network ID of a container by connecting a bash shell to it. w. Use the command to begin the container’s bash.

$ sudo docker exec –it <container id> bash

The execution of this command will take some time. But it will take you to the docker container shell.

Step 4: Install iproute

Now, you have to install the iproute2 and check the IP address. For this, utilize the below-listed command.

$ apt-get install iproute2

You have to wait for some time for its successful installation.

Step 5: Check IP address

Now, we are all set to check the IP address of our docker container. Use the following listed command.

$ ip addr | grep global

The output shows the IP address as displayed in the screenshot attached above.


In this tutorial, we have tried to elaborate on the concept of networking in Docker. Also, we have taught you the method to check the IP address of a docker container. I hope you will easily check the IP address of your required docker container.

About the author

Kalsoom Bibi

Hello, I am a freelance writer and usually write for Linux and other technology related content