0
0
Dockerdevops~20 mins

Network isolation between services in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Network Isolation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Docker network isolation

Which Docker network driver provides complete isolation between containers, preventing them from communicating unless explicitly connected?

Ahost
Bnone
Cbridge
Doverlay
Attempts:
2 left
💡 Hint

Think about a network driver that disables all networking for containers.

💻 Command Output
intermediate
2:00remaining
Inspecting Docker networks

What is the output of the command docker network ls after creating a user-defined bridge network named isolated_net?

Docker
docker network create isolated_net
docker network ls
A
NETWORK ID   NAME           DRIVER    SCOPE
xxxxxx       bridge         bridge    local
xxxxxx       host           host      local
xxxxxx       none           null      local
isolated_net  isolated_net   bridge    local
B
NETWORK ID   NAME           DRIVER    SCOPE
xxxxxx       bridge         host      local
xxxxxx       host           bridge    local
xxxxxx       none           null      local
xxxxxx       isolated_net   overlay   local
C
NETWORK ID   NAME           DRIVER    SCOPE
xxxxxx       bridge         bridge    local
xxxxxx       host           host      local
xxxxxx       none           none      local
xxxxxx       isolated_net   bridge    local
D
NETWORK ID   NAME           DRIVER    SCOPE
xxxxxx       bridge         bridge    local
xxxxxx       host           host      local
xxxxxx       none           null      local
xxxxxx       isolated_net   bridge    local
Attempts:
2 left
💡 Hint

Look for the user-defined network with the correct driver and scope.

Configuration
advanced
2:30remaining
Isolating two services using Docker Compose networks

You want to run two services, web and db, in Docker Compose. The web service should not communicate with db. Which network configuration achieves this isolation?

Docker
version: '3.8'
services:
  web:
    image: nginx
    networks:
      - webnet
  db:
    image: mysql
    networks:
      - dbnet
networks:
  webnet:
  dbnet:
AEach service is attached to a separate network: 'webnet' for web and 'dbnet' for db, isolating them.
BNo networks defined, so Docker isolates services by default.
CBoth services are attached to both networks 'webnet' and 'dbnet' to isolate them.
DBoth services share the same network 'webnet' to isolate them.
Attempts:
2 left
💡 Hint

Think about how Docker Compose networks control communication between services.

Troubleshoot
advanced
2:30remaining
Troubleshooting container communication failure

You have two containers connected to the same user-defined bridge network but they cannot ping each other. What is the most likely cause?

AThe containers are running on the host network driver.
BThe containers are connected to the default bridge network instead.
CThe containers are on different Docker hosts.
DThe containers have different IP addresses.
Attempts:
2 left
💡 Hint

Consider network scope and physical host location.

Best Practice
expert
3:00remaining
Best practice for secure network isolation in multi-service Docker apps

In a multi-service Docker application, what is the best practice to ensure secure network isolation between services that should not communicate?

ACreate separate user-defined bridge networks for each group of services that need to communicate, and connect services only to their required networks.
BUse the host network driver for all services to improve performance and isolate them.
CUse the default bridge network and rely on container firewall rules.
DConnect all services to a single overlay network and use service labels to control communication.
Attempts:
2 left
💡 Hint

Think about how Docker networks control communication and isolation.