When you start two Docker containers without any special network settings, how do they communicate with each other?
Think about Docker's default network isolation and how containers are separated.
By default, Docker containers are connected to the default bridge network, but they cannot resolve each other by container name or communicate easily unless connected to a user-defined network.
What is the output type of the command docker network inspect bridge?
docker network inspect bridgeDocker inspect commands usually return detailed information in a structured format.
The docker network inspect command returns detailed JSON data about the network, including containers connected and network settings.
Which Docker Compose snippet correctly enables two services to communicate by service name?
version: '3.8'
services:
app:
image: myapp
db:
image: mydbThink about how Docker Compose handles networks and service name resolution.
Docker Compose creates a default network for all services in the same file, but explicitly defining a user network ensures clear communication and control.
You created a user-defined network and connected two containers to it, but they still cannot ping each other by container name. What is the most likely cause?
Consider if the containers are on the same physical or virtual machine.
Containers on different Docker hosts need an overlay network to communicate by name; user-defined bridge networks work only on the same host.
Arrange the steps in the correct order to allow two containers to communicate by name using Docker networks.
Think about creating the network before running containers and then using names.
You must first create the network, then run containers attached to it, and finally use their names to communicate.