0
0
Dockerdevops~10 mins

Network isolation between services in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new Docker network named 'isolated_net'.

Docker
docker network create [1]
Drag options to blanks, or click blank then click option'
Aisolated_net
Bbridge
Chost
Dnone
Attempts:
3 left
💡 Hint
Common Mistakes
Using default network drivers like 'bridge' instead of a custom name.
Confusing network driver names with network names.
2fill in blank
medium

Complete the command to run a container named 'webapp' connected to the 'isolated_net' network.

Docker
docker run -d --name webapp --network [1] nginx
Drag options to blanks, or click blank then click option'
Aisolated_net
Bnone
Chost
Dbridge
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bridge' network instead of the custom 'isolated_net'.
Omitting the --network option.
3fill in blank
hard

Fix the error in the command to disconnect a container named 'db' from the 'isolated_net' network.

Docker
docker network [1] isolated_net db
Drag options to blanks, or click blank then click option'
Aremove
Bdisconnect
Cconnect
Ddelete
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'connect' instead of 'disconnect'.
Using 'remove' or 'delete' which are invalid for this command.
4fill in blank
hard

Fill both blanks to create a Docker Compose service named 'api' that uses the 'isolated_net' network and exposes port 5000.

Docker
services:
  api:
    image: myapi
    ports:
      - "[1]:5000"
    networks:
      - [2]

networks:
  isolated_net:
    driver: bridge
Drag options to blanks, or click blank then click option'
A5000
Bisolated_net
C80
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using container port instead of host port in ports mapping.
Using 'default' network instead of 'isolated_net'.
5fill in blank
hard

Fill all three blanks to define a Docker Compose file with two services 'frontend' and 'backend' isolated on 'isolated_net' network, where 'frontend' depends on 'backend'.

Docker
services:
  frontend:
    image: myfrontend
    depends_on:
      - [1]
    networks:
      - [2]
  backend:
    image: mybackend
    networks:
      - [3]

networks:
  isolated_net:
    driver: bridge
Drag options to blanks, or click blank then click option'
Abackend
Bfrontend
Cisolated_net
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping 'frontend' and 'backend' in depends_on.
Using 'default' network instead of 'isolated_net'.