Q. Which of the following commands demotes a manager to a worker?

  • (A) docker node demote
  • (B) docker swarm demote
  • (C) docker manager down
  • (D) docker node update --role worker
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker node demote
Explanation: `docker node demote` is used to change a manager node to a worker.

Q. How do you leave a Docker Swarm?

  • (A) docker swarm exit
  • (B) docker leave
  • (C) docker swarm leave
  • (D) docker node remove
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker swarm leave
Explanation: `docker swarm leave` removes the current node from the swarm.

Q. What happens if all manager nodes are lost in a Swarm?

  • (A) Worker nodes become managers
  • (B) Cluster state is lost unless a backup is available
  • (C) Docker automatically recreates managers
  • (D) Swarm switches to legacy mode
πŸ’¬ Discuss
βœ… Correct Answer: (B) Cluster state is lost unless a backup is available
Explanation: Without manager nodes and a backup of the key-value store, Swarm loses its cluster state.

Q. What command promotes a worker to manager?

  • (A) docker promote node
  • (B) docker node promote
  • (C) docker swarm promote
  • (D) docker node manager
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker node promote
Explanation: `docker node promote` is used to promote a worker node to manager status.

Q. Which command shows whether the current Docker engine is part of an active Swarm?

  • (A) docker swarm status
  • (B) docker node ls
  • (C) docker info
  • (D) docker swarm inspect
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker info
Explanation: The output of docker info includes a Swarm section indicating whether the engine is active, inactive, or pending.

Q. What flag is used with docker swarm init to advertise the manager’s reachable address?

  • (A) --advertise-addr
  • (B) --listen-addr
  • (C) --manager-addr
  • (D) --announce
πŸ’¬ Discuss
βœ… Correct Answer: (A) --advertise-addr
Explanation: --advertise-addr tells other nodes which IP/port to use when joining the Swarm.

Q. Which Swarm service mode ensures one task runs on every eligible node?

  • (A) replicated
  • (B) global
  • (C) constraint
  • (D) daemon
πŸ’¬ Discuss
βœ… Correct Answer: (B) global
Explanation: The global service mode schedules exactly one task on each node that meets the placement criteria.

Q. What is the command to view the current join tokens for a Swarm?

  • (A) docker swarm token list
  • (B) docker node token
  • (C) docker swarm join-token
  • (D) docker service token
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker swarm join-token
Explanation: docker swarm join-token worker|manager displays or rotates the join token required by new nodes.

Q. Which update failure action rolls back a service to the previous version automatically?

  • (A) pause
  • (B) continue
  • (C) rollback
  • (D) shutdown
πŸ’¬ Discuss
βœ… Correct Answer: (C) rollback
Explanation: Setting --update-failure-action rollback reverts tasks to the previous image if an update fails.

Q. Which scheduling filter pins a service to nodes with a specific label?

  • (A) affinity
  • (B) placement constraint
  • (C) spread
  • (D) preference
πŸ’¬ Discuss
βœ… Correct Answer: (B) placement constraint
Explanation: Placement constraints such as --constraint 'node.labels.region==us-east' restrict tasks to labeled nodes.