0
0
Dockerdevops~20 mins

Debugging network issues in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Network Debugging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Identify the output of a Docker network inspect command
What is the output of the following command when run on a Docker network named my_bridge that has two containers connected?
Docker
docker network inspect my_bridge
AError: No such network: my_bridge
B[{"Name":"my_bridge","Id":"abc123","Containers":{}}]
C[{"Name":"bridge","Id":"abc123","Containers":{"container1":{"Name":"web","IPv4Address":"172.18.0.2/16"}}}]
D[{"Name":"my_bridge","Id":"abc123","Containers":{"container1":{"Name":"web","IPv4Address":"172.18.0.2/16"},"container2":{"Name":"db","IPv4Address":"172.18.0.3/16"}}}]
Attempts:
2 left
💡 Hint
Check the network name and container connections.
Troubleshoot
intermediate
2:00remaining
Troubleshoot container connectivity failure
A container cannot reach another container by its service name on a user-defined Docker network. Which of the following is the most likely cause?
AThe containers have the same IP address assigned manually.
BThe containers are on different user-defined networks without a shared network.
CThe Docker daemon is not running.
DThe container's CPU limit is too low.
Attempts:
2 left
💡 Hint
Service name resolution works only within the same user-defined network.
Configuration
advanced
2:00remaining
Correct Docker Compose network configuration for service communication
Given this Docker Compose snippet, which option correctly configures the network so that app and db services can communicate by service name?
Docker
version: '3.8'
services:
  app:
    image: myapp
    networks:
      - backend
  db:
    image: postgres
    networks:
      - backend
networks:
  backend:
    driver: bridge
AKeep the configuration as is; both services are on the same user-defined network 'backend'.
BRemove the networks section; Docker Compose will use the default network automatically.
CChange the network driver to 'host' to allow communication.
DAssign static IPs to both services on different networks.
Attempts:
2 left
💡 Hint
User-defined bridge networks enable service name resolution.
Best Practice
advanced
2:00remaining
Best practice for isolating container network traffic
Which option is the best practice to isolate network traffic between two groups of containers in Docker?
ACreate two separate user-defined bridge networks and connect containers to their respective networks.
BUse the default bridge network and rely on container names for isolation.
CAssign all containers to the host network driver.
DUse static IP addresses on the default network to separate traffic.
Attempts:
2 left
💡 Hint
User-defined networks provide better isolation than the default bridge.
🔀 Workflow
expert
3:00remaining
Order the steps to debug a Docker container network connectivity issue
Put these steps in the correct order to debug why a container cannot reach another container by service name on a user-defined network.
A2,1,4,3
B2,3,1,4
C1,2,3,4
D1,2,4,3
Attempts:
2 left
💡 Hint
Start by verifying network membership before testing connectivity and DNS.