Open In App

How To Inspect Docker Network?

Last Updated : 26 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Applications that use containers require an understanding of Docker’s network infrastructure. With an emphasis on security, optimizing, and troubleshooting, this guide delves into Docker network inspection. Learn how to examine networks, comprehend setups, and troubleshoot connectivity problems with tools and commands that are accessible to both novice and experienced Docker users. Develop your managerial abilities with Docker networks in order to guarantee reliable containerized apps and enhanced performance.

What is the Docker Network?

The Docker container that is deployed in Docker needs to be communicated to exchange data, for example.

Let’s take an application that uses the database and SQL. And if you deploy both the application and database inside the docker, then you need to make a connection between the two containers. Whenever new data is induced in the application, it should be stored in the database. In that case, there must be a connection between the two containers deployed in the docker.

In this case, the network will help us make the connection between the two Docker containers. Where they can communicate and exchange data between them.

Why Do You Need to Inspect the Docker Network?

The need to inspect the Docker network depends on the different scenarios. For example, if you want to deploy two containers in the same network, you need to know the name and network ID. By inspecting the Docker network, you can get the above.

You can get the configurations of the docker network, like the subnet and gateway of the docker network. Sometimes you may be required to know the data and time of the docker network created. you can get all of this by inspecting the docker network command used.

docker network inspect <Network ID>

What Are the Different Types of Docker Networks Drivers?

There are three default networks as mentioned below

Default Docker Networks

1. Bridge

  • The containers that are newly created will created by default in the bridge network.
  • The containers that are deployed in the bridge network will communicate with each other only by using the container IP. The containers that are deployed in the bridge network cannot be communicated with the container names.

2. Host

  • If we create containers in host network. Container will not have IP Address. Container will be created in a system network.
  • But we can’t create more than one container with same container port in host network. We no need to do port publish to access containers.

3. None/null

  • If we create containers in none/null network. Container will not have IP Address. We can’t access these containers from out side or from any other container.

Add On Networks In Docker

1. REX-RAY

The Docker REX- RAY plugin is mainly used to attach the external volumes to our containers which are running in the containerization platforms. REX-RAY is a plugin that is written in the go-language it will not be available locally you need to download the plugin. REX – RAY plugin provides EBS volumes to the docker containers.

2. Meclavan

Meclavan driver is used in docker to assign the MAC Ip address to the docker running container.

How To Create Custom Docker Network?

Follow the steps mentioned below to create custom docker bridge network.

Step 1: First all the docker networks available in the docker.

docker network ls

“docker network” ls will list all the networks available in the docker.

Step 2: Create docker network using below command (If it’s not created already).

 docker network create  -d bridge <network name>

docker network create

Here we have created nginx coutm network by using the bridge network driver as shown in the image above.

Step-By-Step Process To Inspect The Docker Network

In the above we have created the coustm docker network here we will inspect the docker network which is aleready created or avalible in the docker.

Step 1: List all the network avalible in the docker and choose the network which you want to inspect after that you need the network id to inspect the docker network.

Step 2: You can use the following command to inspect the docker work.

docker inspect <network ID>

Docker network inspect

when you are inspecting the docker network you get all the details like Name of the docker network and data and time of network created and also it will specify the by which driver you have been create the docker network.

How to inspect docker network – FAQ’s

How to inspect docker network?

Use docker network ls to list networks and docker network inspect [network_name] to inspect a specific network, replacing [network_name] with the desired network’s name or ID.

How to inspect network IP address in docker?

Run docker inspect [container_name_or_id] and find the container’s IP address under .NetworkSettings.IPAddress in the output. Alternatively, use docker inspect -f ‘{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}’ [container_name_or_id].


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads