Which of the following is the main reason to create a custom Docker network instead of using the default bridge network?
Think about how containers talk to each other and how you can control that.
Custom networks allow you to isolate containers and control which containers can communicate, improving security and organization.
What is the output of the command docker network ls after creating a custom network named my_custom_net?
docker network create my_custom_net docker network ls
Custom networks appear alongside default networks with the same driver unless specified otherwise.
When you create a custom network with the default bridge driver, it appears in the list along with default networks like bridge, host, and none.
You have two containers: app and db. You want them to communicate securely using a custom network named secure_net. Which sequence of commands correctly sets this up?
Think about how to start containers directly attached to a network.
Starting containers with --network=secure_net attaches them to the custom network immediately, enabling secure communication.
You started two containers on the default bridge network but they cannot ping each other by container name. What is the most likely reason?
Think about how container names resolve to IP addresses on different networks.
The default bridge network does not provide automatic DNS resolution for container names, so containers cannot reach each other by name without custom networks.
Which practice best improves security when using Docker networks in a multi-container application?
Think about isolating parts of your app to limit access.
Separating containers into custom networks limits communication to only what is necessary, reducing attack surface and improving security.