Q. What happens when you remove a Docker network in use?

  • (A) It is forcefully removed
  • (B) Docker stops all containers
  • (C) It gives an error
  • (D) It disconnects all containers
πŸ’¬ Discuss
βœ… Correct Answer: (C) It gives an error
Explanation: Docker prevents removal of a network that is currently in use by containers.

Q. Which of these drivers isolates the container with no network access?

  • (A) host
  • (B) bridge
  • (C) none
  • (D) macvlan
πŸ’¬ Discuss
βœ… Correct Answer: (C) none
Explanation: The 'none' driver disables all networking for the container.

Q. Which command disconnects a container from a network?

  • (A) docker network delete
  • (B) docker network disconnect
  • (C) docker container disconnect
  • (D) docker disconnect
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker network disconnect
Explanation: `docker network disconnect` is used to remove a container from a specified network.

Q. What is the purpose of the 'macvlan' driver in Docker?

  • (A) To share IPs with host
  • (B) To disable networking
  • (C) To assign containers MAC addresses and connect to physical network
  • (D) To isolate containers using host DNS
πŸ’¬ Discuss
βœ… Correct Answer: (C) To assign containers MAC addresses and connect to physical network
Explanation: macvlan allows containers to appear as physical devices on the network with their own MAC addresses.

Q. Which Docker network mode allows direct container-to-container communication without port mapping?

  • (A) host
  • (B) bridge
  • (C) overlay
  • (D) container
πŸ’¬ Discuss
βœ… Correct Answer: (D) container
Explanation: The 'container' mode allows containers to share the same network namespace.

Q. Which Docker network driver is used by default?

  • (A) host
  • (B) overlay
  • (C) bridge
  • (D) none
πŸ’¬ Discuss
βœ… Correct Answer: (C) bridge
Explanation: Docker uses the 'bridge' network driver by default for containers on a single host.

Q. Which Docker command is used to create a custom network?

  • (A) docker new network
  • (B) docker network create
  • (C) docker create network
  • (D) docker net new
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker network create
Explanation: `docker network create` is used to define a new custom network.

Q. What type of network driver is required for multi-host container communication?

  • (A) bridge
  • (B) host
  • (C) none
  • (D) overlay
πŸ’¬ Discuss
βœ… Correct Answer: (D) overlay
Explanation: The 'overlay' driver allows containers running on different Docker hosts to communicate securely.

Q. Which Docker network type provides no external network access?

  • (A) bridge
  • (B) host
  • (C) none
  • (D) overlay
πŸ’¬ Discuss
βœ… Correct Answer: (C) none
Explanation: The 'none' driver disables all networking for the container.

Q. In a 'bridge' network, how do containers communicate with each other?

  • (A) Using container name or IP address
  • (B) Only through exposed ports
  • (C) They cannot communicate
  • (D) Only via host machine
πŸ’¬ Discuss
βœ… Correct Answer: (A) Using container name or IP address
Explanation: Containers on the same bridge network can communicate using container names or IPs.