Q. What is the function of a network alias in Docker?

  • (A) Assigns IP addresses
  • (B) Provides DNS-based names
  • (C) Acts as a backup route
  • (D) Encrypts traffic
πŸ’¬ Discuss
βœ… Correct Answer: (B) Provides DNS-based names
Explanation: A network alias allows referencing containers by alternative DNS names.

Q. What does the `--internal` flag do when creating a Docker network?

  • (A) Makes the network encrypted
  • (B) Allows only internal container communication
  • (C) Enables port forwarding
  • (D) Disables Docker DNS
πŸ’¬ Discuss
βœ… Correct Answer: (B) Allows only internal container communication
Explanation: An `--internal` network doesn't allow external access to containers attached to it.

Q. Can a user-defined bridge network have custom subnet and gateway?

  • (A) No
  • (B) Yes, but only on Windows
  • (C) Yes
  • (D) Only in Swarm
πŸ’¬ Discuss
βœ… Correct Answer: (C) Yes
Explanation: You can specify custom subnets and gateways while creating user-defined bridge networks.

Q. Which Docker command removes a network?

  • (A) docker network rm
  • (B) docker rm network
  • (C) docker network delete
  • (D) docker remove network
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker network rm
Explanation: `docker network rm` deletes a Docker network.

Q. In a Docker network, which service provides DNS-based container name resolution?

  • (A) etcd
  • (B) Consul
  • (C) embedded DNS server
  • (D) Swarm Agent
πŸ’¬ Discuss
βœ… Correct Answer: (C) embedded DNS server
Explanation: Docker includes an embedded DNS server for service discovery and name resolution.

Q. What does Docker use for internal DNS resolution?

  • (A) /etc/hosts only
  • (B) External DNS only
  • (C) Built-in DNS server
  • (D) Swarm DNS
πŸ’¬ Discuss
βœ… Correct Answer: (C) Built-in DNS server
Explanation: Docker uses an embedded DNS server to resolve container and service names.

Q. What happens if you remove a network with active containers connected?

  • (A) It removes containers too
  • (B) It throws an error
  • (C) It silently fails
  • (D) It disconnects containers automatically
πŸ’¬ Discuss
βœ… Correct Answer: (B) It throws an error
Explanation: Docker doesn't allow you to remove a network if containers are still connected.

Q. Which Docker network mode allows containers to share the host’s network stack?

  • (A) bridge
  • (B) overlay
  • (C) host
  • (D) none
πŸ’¬ Discuss
βœ… Correct Answer: (C) host
Explanation: The 'host' network mode allows containers to use the host’s networking directly.

Q. Which network driver should be used for multi-host container communication?

  • (A) host
  • (B) bridge
  • (C) overlay
  • (D) none
πŸ’¬ Discuss
βœ… Correct Answer: (C) overlay
Explanation: The overlay driver is designed for multi-host networking in Docker Swarm.

Q. What is the function of the 'none' network driver?

  • (A) Disables networking
  • (B) Enables full network access
  • (C) Shares network with another container
  • (D) Creates an isolated overlay network
πŸ’¬ Discuss
βœ… Correct Answer: (A) Disables networking
Explanation: The 'none' driver disables all networking for the container.