0
0
Dockerdevops~10 mins

Connecting containers to multiple networks in Docker - Interactive Code Practice

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

Complete the command to create a Docker network named 'frontend'.

Docker
docker network create [1]
Drag options to blanks, or click blank then click option'
Afrontend
Bbackend
Cdefault
Dbridge
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bridge' creates the default network, not a custom one.
Using 'backend' creates a different network name.
2fill in blank
medium

Complete the command to run a container named 'webapp' attached to the 'frontend' network.

Docker
docker run -d --name webapp --network [1] nginx
Drag options to blanks, or click blank then click option'
Abackend
Bhost
Cdefault
Dfrontend
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'backend' connects to the wrong network.
Using 'host' connects to the host network, not a Docker network.
3fill in blank
hard

Fix the error in the command to connect the running container 'webapp' to the 'backend' network.

Docker
docker network connect [1] webapp
Drag options to blanks, or click blank then click option'
Abackend
Bwebapp
Cfrontend
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using the container name instead of the network name first.
Using 'frontend' instead of 'backend'.
4fill in blank
hard

Fill both blanks to list all networks a container named 'db' is connected to.

Docker
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}} [1] {{end}}' [2]
Drag options to blanks, or click blank then click option'
A.NetworkID
Bdb
C.IPAddress
Dwebapp
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong property like '.NetworkID' which is not directly accessible.
Using the wrong container name.
5fill in blank
hard

Fill all three blanks to create a container 'app' connected to 'frontend' and then connect it to 'backend'.

Docker
docker run -d --name [1] --network [2] nginx && docker network connect [3] [1]
Drag options to blanks, or click blank then click option'
Aapp
Bfrontend
Cbackend
Dwebapp
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing container names and network names.
Using 'webapp' instead of 'app'.