Recall & Review
beginner
What is the command to connect an existing Docker container to a new network?
Use
docker network connect <network-name> <container-name> to connect a running or stopped container to an additional network.Click to reveal answer
intermediate
How can a Docker container be connected to multiple networks at creation?
Use the
--network flag for the first network and then connect additional networks using docker network connect after the container is created.Click to reveal answer
beginner
What happens if a container is connected to multiple Docker networks?
The container can communicate with other containers on all connected networks, each network providing a separate IP address inside the container.
Click to reveal answer
beginner
How to list all networks a Docker container is connected to?
Run
docker inspect <container-name> and look under the Networks section in the output.Click to reveal answer
intermediate
Can a container be disconnected from a Docker network? If yes, how?
Yes, use
docker network disconnect <network-name> <container-name> to remove a container from a network.Click to reveal answer
Which command connects a running container named 'webapp' to a network called 'frontend'?
✗ Incorrect
The correct syntax is
docker network connect <network> <container>.What is true about a container connected to multiple Docker networks?
✗ Incorrect
Each network assigns its own IP address to the container, allowing communication on all connected networks.
How do you check which networks a container is connected to?
✗ Incorrect
The
docker inspect command shows detailed info including connected networks.Can you connect a container to a network after it has started?
✗ Incorrect
Docker allows connecting running containers to additional networks anytime.
What command removes a container from a Docker network?
✗ Incorrect
The correct command is
docker network disconnect with network and container names.Explain how to connect a Docker container to multiple networks and why this might be useful.
Think about how containers can talk on different networks and how to add networks after creation.
You got /4 concepts.
Describe the steps to verify and manage network connections of a Docker container.
Focus on commands to view and change network connections.
You got /4 concepts.