0
0
Dockerdevops~10 mins

Rolling updates in Docker - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Rolling updates
Start with current version running
Deploy new version to some containers
Check new version health
Shift traffic
Update remaining containers
All containers running new version
End
Rolling updates replace old containers with new ones gradually, checking health before continuing.
Execution Sample
Docker
docker service update --image myapp:v2 myapp_service
# Docker replaces containers one by one
# Checks health before moving on
This command updates a Docker service to a new image version using rolling updates.
Process Table
StepActionContainers UpdatedHealth CheckResultNext Step
1Start rolling update0/3N/AOld version runningUpdate first container
2Update container 11/3PassContainer 1 running v2Update container 2
3Update container 22/3PassContainer 2 running v2Update container 3
4Update container 33/3PassAll containers running v2Complete update
5Complete3/3N/ARolling update successfulEnd
💡 All containers updated and passed health checks, rolling update finished successfully.
Status Tracker
VariableStartAfter 1After 2After 3Final
Containers Updated01233
Health StatusN/APassPassPassPass
Version Runningv1v2v2v2v2
Key Moments - 2 Insights
Why does Docker update containers one by one instead of all at once?
Updating one container at a time ensures the service stays available and lets Docker check health before continuing, as shown in steps 2-4 of the execution table.
What happens if a container fails the health check during update?
If a container fails health check, Docker stops the update and can rollback or pause, preventing broken service. This is implied in the flow where 'Fail' leads to rollback or fix.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, how many containers are updated after step 3?
A1
B3
C2
D0
💡 Hint
Check the 'Containers Updated' column at step 3 in the execution table.
At which step does the rolling update complete successfully?
AStep 4
BStep 5
CStep 3
DStep 2
💡 Hint
Look for the row where 'Result' says 'Rolling update successful' in the execution table.
If the health check fails at step 2, what would happen next?
ARollback or fix the issue
BContinue updating next containers
CIgnore and finish update
DUpdate all containers at once
💡 Hint
Refer to the concept flow where a failed health check leads to rollback or fix.
Concept Snapshot
Rolling updates replace old containers gradually.
Docker updates one container at a time.
Health checks after each update ensure stability.
If health fails, update pauses or rolls back.
This keeps service available during updates.
Full Transcript
Rolling updates in Docker mean updating containers one by one to a new version. First, the current version runs. Then Docker updates one container and checks if it is healthy. If it passes, Docker moves to the next container. This continues until all containers run the new version. If any container fails health check, Docker stops and can rollback. This process keeps the service running without downtime.