🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (178K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
In this guide, we'll deep dive into the docker inspect command for networks, exploring its usage and interpreting its output.
Why Inspect Docker Networks?
Configuration Verification: Ensure that a network's settings match its intended configuration.
Debugging: Troubleshoot connectivity or configuration issues.
Documentation: Keep a record of the network setup for documentation or reporting purposes.
Inspecting a Docker Network
To inspect a Docker network, you'd typically use:
docker inspect NETWORK_NAME_OR_IDFor instance, to inspect a network named my_network:
$ docker inspect my_network
[
{
"Name": "my_network",
"Id": "f7b1dca5d1a41ed6bd15f7ed74642f4b2b3a7e7447e6d9b6e264a4be8455b5fd",
"Created": "2023-08-15T10:25:27.916512735Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"Containers": {},
"Options": {},
"Labels": {}
}
]From the above output:
Name: Name of the network.
Id: Unique identifier for the network.
Scope: Specifies the level at which the network operates (local, global, or swarm).
Driver: The network driver used (bridge, host, overlay, macvlan, etc.).
IPAM: IP Address Management, detailing the subnet and gateway associated with the network.
Containers: Lists containers associated with this network.
Inspecting Multiple Docker Networks
While docker inspect primarily targets individual entities, its design allows for multiple arguments, enabling the inspection of multiple networks simultaneously.
docker inspect NETWORK_NAME_1 NETWORK_NAME_2 ... NETWORK_NAME_NFor instance, to inspect networks named frontend_network and backend_network:
$ docker inspect frontend_network backend_network
[
{
"Name": "frontend_network",
"Id": "a2b3f4g5h6j7k8l9p0o1i2u3y4t5r6e7w8e9r0t1",
...
"IPAM": {
...
"Config": [
{
"Subnet": "172.18.1.0/24",
...
}
]
},
...
"Containers": {},
...
},
{
"Name": "backend_network",
"Id": "z9x8c7v6b5n4m3l2k1j0h9g8f7e6d5s4a3z2x1c2",
...
"IPAM": {
...
"Config": [
{
"Subnet": "172.18.2.0/24",
...
}
]
},
...
"Containers": {},
...
}
]The output is a JSON array, each element representing the inspection details of the specified networks in the order they were listed in the command.
Conclusion
In this guide, we have seen how to inspect a single Docker network as well as inspect multiple Docker networks.
Related Networking Guides
My Top and Bestseller Udemy Courses. The sale is going on with a 70 - 80% discount. The discount coupon has been added to each course below:
Build REST APIs with Spring Boot 4, Spring Security 7, and JWT
[NEW] Learn Apache Maven with IntelliJ IDEA and Java 25
ChatGPT + Generative AI + Prompt Engineering for Beginners
Spring 7 and Spring Boot 4 for Beginners (Includes 8 Projects)
Available in Udemy for Business
Building Real-Time REST APIs with Spring Boot - Blog App
Available in Udemy for Business
Building Microservices with Spring Boot and Spring Cloud
Available in Udemy for Business
Java Full-Stack Developer Course with Spring Boot and React JS
Available in Udemy for Business
Build 5 Spring Boot Projects with Java: Line-by-Line Coding
Testing Spring Boot Application with JUnit and Mockito
Available in Udemy for Business
Spring Boot Thymeleaf Real-Time Web Application - Blog App
Available in Udemy for Business
Master Spring Data JPA with Hibernate
Available in Udemy for Business
Spring Boot + Apache Kafka Course - The Practical Guide
Available in Udemy for Business
Comments
Post a Comment
Leave Comment