0
0
Dockerdevops~30 mins

Rolling updates in Docker - Mini Project: Build & Apply

Choose your learning style9 modes available
Rolling Updates with Docker
📖 Scenario: You manage a web application running in Docker containers. You want to update the application without downtime by using rolling updates.
🎯 Goal: Learn how to perform a rolling update of a Docker service to replace old containers with new ones smoothly.
📋 What You'll Learn
Create a Docker service running a specific image
Set a variable for the new image version
Update the Docker service to use the new image version
Verify the update by checking the service status
💡 Why This Matters
🌍 Real World
Rolling updates let you update live applications without downtime, keeping users happy.
💼 Career
DevOps engineers use rolling updates to deploy new versions safely and reliably.
Progress0 / 4 steps
1
Create a Docker service
Run the command docker service create --name webapp --replicas 3 nginx:1.21 to create a Docker service named webapp with 3 replicas using the nginx:1.21 image.
Docker
Need a hint?

This command creates a service called webapp with 3 containers running nginx:1.21.

2
Set the new image version variable
Create a shell variable called NEW_IMAGE and set it to nginx:1.23.
Docker
Need a hint?

Use NEW_IMAGE=nginx:1.23 to set the variable.

3
Update the Docker service with the new image
Run the command docker service update --image $NEW_IMAGE webapp to update the webapp service to use the new image stored in NEW_IMAGE.
Docker
Need a hint?

This command updates the service to the new image version smoothly.

4
Check the service update status
Run docker service ps webapp to display the status of the webapp service tasks and verify the rolling update.
Docker
Need a hint?

This command shows the tasks and their current state to confirm the update.