Bird
Raised Fist0
Dockerdevops~10 mins

Creating custom bridge networks in Docker - Interactive Practice

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

Complete the command to create a custom bridge network named 'my_bridge'.

Docker
docker network [1] my_bridge
Drag options to blanks, or click blank then click option'
Astart
Bbuild
Ccreate
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'docker network run' instead of 'create'.
Using 'docker network build' which is for images, not networks.
2fill in blank
medium

Complete the command to list all Docker networks including the custom bridge networks.

Docker
docker network [1]
Drag options to blanks, or click blank then click option'
Aprune
Binspect
Crm
Dls
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'docker network inspect' which shows details of one network only.
Using 'docker network rm' which deletes networks.
3fill in blank
hard

Fix the error in the command to create a custom bridge network with a specific subnet.

Docker
docker network create --driver bridge --subnet [1] my_custom_net
Drag options to blanks, or click blank then click option'
A192.168.1.0/24
B192.168.1.256/24
C192.168.1.0/33
D192.168.1.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using an IP with 256 in a segment which is invalid.
Using a mask larger than 32 or missing mask.
4fill in blank
hard

Fill both blanks to create a custom bridge network named 'dev_net' with a gateway IP of 172.18.0.1.

Docker
docker network create --driver [1] --subnet 172.18.0.0/16 --gateway [2] dev_net
Drag options to blanks, or click blank then click option'
Abridge
Bhost
C172.18.0.1
Doverlay
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'host' or 'overlay' as driver for a bridge network.
Putting driver name as gateway IP.
5fill in blank
hard

Fill all three blanks to create a custom bridge network named 'test_net' with subnet 10.10.0.0/16 and gateway 10.10.0.1.

Docker
docker network create --driver [1] --subnet [2] --gateway [3] test_net
Drag options to blanks, or click blank then click option'
Abridge
B10.10.0.0/16
C10.10.0.1
Dhost
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'host' driver instead of 'bridge'.
Using invalid subnet or gateway IP.

Practice

(1/5)
1. What is the main purpose of creating a custom bridge network in Docker?
easy
A. To increase the CPU usage of containers
B. To allow containers to communicate privately and securely
C. To automatically update container images
D. To create a backup of container data

Solution

  1. Step 1: Understand Docker networking basics

    Docker uses networks to connect containers. The default bridge network is shared and less secure.
  2. Step 2: Purpose of custom bridge networks

    Custom bridge networks isolate containers, allowing private and secure communication between them.
  3. Final Answer:

    To allow containers to communicate privately and securely -> Option B
  4. Quick Check:

    Custom bridge network = private container communication [OK]
Hint: Custom bridge = private container communication [OK]
Common Mistakes:
  • Thinking custom bridge increases CPU usage
  • Confusing network creation with image updates
  • Assuming it creates data backups
2. Which of the following is the correct command to create a custom bridge network named my_bridge?
easy
A. docker network create --driver bridge my_bridge
B. docker create network bridge my_bridge
C. docker network new --type bridge my_bridge
D. docker bridge create network my_bridge

Solution

  1. Step 1: Recall Docker network creation syntax

    The correct syntax is docker network create --driver bridge NETWORK_NAME.
  2. Step 2: Match the command with the syntax

    docker network create --driver bridge my_bridge matches the correct syntax exactly for creating a bridge network named my_bridge.
  3. Final Answer:

    docker network create --driver bridge my_bridge -> Option A
  4. Quick Check:

    Correct syntax = docker network create --driver bridge [OK]
Hint: Use 'docker network create --driver bridge NAME' [OK]
Common Mistakes:
  • Using wrong command order
  • Missing --driver flag
  • Using 'new' or 'create' incorrectly
3. Given the command docker network create --driver bridge isolated_net, what will be the output of docker network ls related to this network?
medium
A. No change; the network list remains the same
B. An error message saying 'driver not found' will appear
C. The default bridge network will be removed
D. A new network named 'isolated_net' with driver 'bridge' will appear in the list

Solution

  1. Step 1: Understand the effect of the create command

    The command creates a new bridge network named 'isolated_net'.
  2. Step 2: Check the network list after creation

    Running docker network ls shows all networks including the newly created 'isolated_net' with driver 'bridge'.
  3. Final Answer:

    A new network named 'isolated_net' with driver 'bridge' will appear in the list -> Option D
  4. Quick Check:

    New bridge network appears in list [OK]
Hint: New bridge network shows in 'docker network ls' [OK]
Common Mistakes:
  • Expecting an error for valid driver
  • Thinking default bridge is removed
  • Assuming no change in network list
4. You ran docker network create --driver bridge without specifying a network name. What is the likely result?
medium
A. Docker creates a network named 'bridge' by default
B. Docker creates a network with a random generated name
C. Docker throws an error about missing network name
D. Docker creates the default bridge network again

Solution

  1. Step 1: Check required arguments for network creation

    The docker network create command requires a network name after options.
  2. Step 2: Result of missing network name

    Omitting the network name causes Docker to throw an error indicating the missing argument.
  3. Final Answer:

    Docker throws an error about missing network name -> Option C
  4. Quick Check:

    Missing name causes error [OK]
Hint: Always specify network name after options [OK]
Common Mistakes:
  • Assuming Docker auto-generates network name
  • Thinking 'bridge' is default name created
  • Confusing with default bridge network
5. You want two containers to communicate only with each other and not with other containers on the host. Which steps correctly create and use a custom bridge network named private_net?
hard
A. Create network with docker network create --driver bridge private_net and run containers with --network private_net
B. Run containers with --link option without creating a network
C. Use default bridge network and assign static IPs manually
D. Create network with docker network create private_net without specifying driver

Solution

  1. Step 1: Create a custom bridge network

    Use docker network create --driver bridge private_net to create an isolated network.
  2. Step 2: Run containers attached to this network

    Start containers with --network private_net so they communicate only within this network.
  3. Final Answer:

    Create network with 'docker network create --driver bridge private_net' and run containers with '--network private_net' -> Option A
  4. Quick Check:

    Custom bridge + --network = isolated container communication [OK]
Hint: Create bridge network then run containers with --network [OK]
Common Mistakes:
  • Using --link which is deprecated
  • Relying on default bridge for isolation
  • Omitting --driver option causing default driver
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard