0
0
Dockerdevops~20 mins

Why custom networks matter in Docker - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Docker Network Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why use custom Docker networks?

Which of the following is the main reason to create a custom Docker network instead of using the default bridge network?

ATo isolate containers and control communication between them
BTo increase container CPU usage automatically
CTo enable containers to run without Docker installed
DTo reduce the size of Docker images
Attempts:
2 left
💡 Hint

Think about how containers talk to each other and how you can control that.

💻 Command Output
intermediate
2:00remaining
Output of listing Docker networks

What is the output of the command docker network ls after creating a custom network named my_custom_net?

Docker
docker network create my_custom_net
docker network ls
A
NETWORK ID   NAME           DRIVER    SCOPE
<id>         bridge         bridge    local
<id>         host           host      local
<id>         none           null      local
<id>         my_custom_net  bridge    local
BError: network my_custom_net not found
C
NETWORK ID   NAME           DRIVER    SCOPE
<id>         bridge         overlay   local
<id>         my_custom_net  host      local
DNo networks found
Attempts:
2 left
💡 Hint

Custom networks appear alongside default networks with the same driver unless specified otherwise.

🔀 Workflow
advanced
2:00remaining
Connecting containers to a custom network

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?

A
docker network create secure_net
docker network connect secure_net app
docker network connect secure_net db
B
docker network create secure_net
docker run --network=secure_net app
docker run --network=secure_net db
C
docker network create secure_net
docker run app
docker run db
D
docker network create secure_net
docker network disconnect bridge app
docker network disconnect bridge db
docker network connect secure_net app
docker network connect secure_net db
Attempts:
2 left
💡 Hint

Think about how to start containers directly attached to a network.

Troubleshoot
advanced
2:00remaining
Why can't containers communicate on default bridge network?

You started two containers on the default bridge network but they cannot ping each other by container name. What is the most likely reason?

ADocker daemon is not running
BContainers must be on the host network to communicate
CThe default bridge network does not support automatic DNS resolution between containers
DContainers need to share the same image to communicate
Attempts:
2 left
💡 Hint

Think about how container names resolve to IP addresses on different networks.

Best Practice
expert
2:00remaining
Best practice for Docker network security

Which practice best improves security when using Docker networks in a multi-container application?

ARun all containers with host networking to improve performance
BUse the default bridge network for all containers to simplify setup
CDisable Docker networking to prevent all container communication
DCreate separate custom networks for different application components and restrict container connections accordingly
Attempts:
2 left
💡 Hint

Think about isolating parts of your app to limit access.