Q. Which command connects a running container to a network?

  • (A) docker run --connect
  • (B) docker connect network
  • (C) docker network connect
  • (D) docker add network
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker network connect
Explanation: `docker network connect` attaches a running container to an additional network.

Q. Which network driver is best for production multi-host deployments?

  • (A) host
  • (B) bridge
  • (C) overlay
  • (D) none
πŸ’¬ Discuss
βœ… Correct Answer: (C) overlay
Explanation: Overlay networks are designed for secure, scalable multi-host deployments in production.

Q. What does `docker network prune` do?

  • (A) Deletes all unused networks
  • (B) Removes all containers
  • (C) Deletes all bridge networks
  • (D) Deletes running networks
πŸ’¬ Discuss
βœ… Correct Answer: (A) Deletes all unused networks
Explanation: `docker network prune` removes all networks not used by at least one container.

Q. Which protocol does Docker networking primarily use?

  • (A) ICMP
  • (B) UDP
  • (C) TCP/IP
  • (D) HTTP
πŸ’¬ Discuss
βœ… Correct Answer: (C) TCP/IP
Explanation: Docker networking is built on traditional TCP/IP protocols to allow standard communication between containers.

Q. What is Docker Swarm used for?

  • (A) Building Docker images
  • (B) Creating container volumes
  • (C) Orchestrating multiple Docker containers across multiple nodes
  • (D) Logging Docker output
πŸ’¬ Discuss
βœ… Correct Answer: (C) Orchestrating multiple Docker containers across multiple nodes
Explanation: Docker Swarm is a native clustering and orchestration tool for Docker that manages containers across multiple hosts.

Q. What command is used to initialize a Docker Swarm?

  • (A) docker swarm init
  • (B) docker swarm create
  • (C) docker swarm start
  • (D) docker swarm up
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker swarm init
Explanation: `docker swarm init` is the command used to initialize a new Swarm cluster.

Q. Which command adds a new node to the Swarm as a worker?

  • (A) docker swarm join --manager
  • (B) docker swarm add --worker
  • (C) docker swarm join
  • (D) docker swarm node add
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker swarm join
Explanation: `docker swarm join` with the appropriate token adds a new worker node to the Swarm.

Q. Which command shows the nodes in a Swarm cluster?

  • (A) docker swarm list
  • (B) docker node ls
  • (C) docker swarm status
  • (D) docker cluster show
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker node ls
Explanation: `docker node ls` lists all the nodes participating in the Swarm cluster.

Q. What is a service in Docker Swarm?

  • (A) A container log
  • (B) A configuration file
  • (C) A definition for a task to be executed by the swarm
  • (D) An image pulled from Docker Hub
πŸ’¬ Discuss
βœ… Correct Answer: (C) A definition for a task to be executed by the swarm
Explanation: A service in Docker Swarm defines how containers (tasks) are deployed across the cluster.

Q. Which command deploys a new service in Docker Swarm?

  • (A) docker create service
  • (B) docker swarm run
  • (C) docker service create
  • (D) docker run service
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker service create
Explanation: `docker service create` is used to deploy a new service in a Docker Swarm.