Which of the following best explains why container networking is important?
Think about how multiple containers work together in an application.
Containers often run parts of an application that must talk to each other or to outside services. Networking allows this communication.
What is the output of the following command if a container named webapp is running and connected to the default bridge network?
docker inspect -f '{{json .NetworkSettings.Networks }}' webapp
The default Docker network is called bridge and containers get an IP in the 172.17.0.0/16 range.
The command shows the network details of the container. The default bridge network assigns IP addresses like 172.17.0.x.
You want two containers, app1 and app2, to communicate securely. Which sequence of commands correctly creates a user-defined network and runs both containers attached to it?
Create the network first, then run containers attached to it.
You must create the network before running containers that use it. Then run containers specifying the network.
Two containers on the same user-defined network cannot ping each other by container name. What is the most likely cause?
Think about multi-host container networking and DNS resolution.
Containers on different hosts need an overlay network to communicate by name. Without it, DNS resolution fails.
For a microservices app deployed on multiple Docker hosts, which network driver is best to enable secure, scalable container communication?
Consider multi-host networking and service discovery.
The overlay driver allows containers on different hosts to communicate securely and supports service discovery, ideal for microservices.