Docker - SwarmYou want to scale a service named 'worker' to 5 replicas but only 3 nodes are available in the swarm. What will happen?ADocker will only run 3 replicas, one per nodeBDocker will fail to scale and show an errorCDocker will run 5 replicas distributed across the 3 nodes, some nodes running multiple replicasDDocker will create new nodes automatically to run all replicasCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand Docker swarm schedulingSwarm can run multiple replicas on the same node if needed.Step 2: Predict behavior with fewer nodes than replicasWith 3 nodes and 5 replicas, swarm places multiple replicas on some nodes.Final Answer:Docker will run 5 replicas distributed across the 3 nodes, some nodes running multiple replicas -> Option CQuick Check:Swarm schedules multiple replicas per node if needed [OK]Quick Trick: Swarm can place multiple replicas on one node [OK]Common Mistakes:Assuming one replica per node limitExpecting automatic node creationThinking scaling fails without enough nodes
Master "Swarm" in Docker9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Docker Quizzes Docker Security - Running containers as non-root - Quiz 13medium Docker Security - Running containers as non-root - Quiz 14medium Docker Swarm - Manager and worker nodes - Quiz 7medium Docker Swarm - Why orchestration matters - Quiz 3easy Docker in CI/CD - GitLab CI with Docker - Quiz 10hard Docker in CI/CD - Deploying from CI/CD pipeline - Quiz 11easy Docker in CI/CD - GitHub Actions with Docker - Quiz 9hard Image Optimization - Distroless images concept - Quiz 14medium Production Patterns - Blue-green deployment with containers - Quiz 12easy Resource Management - Resource monitoring per container - Quiz 1easy