0
0
Dockerdevops~10 mins

Canary deployment pattern in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the Docker command to run a container with a specific image tag for canary deployment.

Docker
docker run -d --name canary_app [1] myapp:canary
Drag options to blanks, or click blank then click option'
A-p 8080:80
B--rm
C-it
D--network host
Attempts:
3 left
💡 Hint
Common Mistakes
Using --rm removes the container after it stops, which is not suitable for a running canary.
Using -it is for interactive mode, not needed here.
Using --network host bypasses port mapping, which is less flexible.
2fill in blank
medium

Complete the Docker Compose service definition to deploy a canary version of the app with limited replicas.

Docker
services:
  app_canary:
    image: myapp:canary
    deploy:
      replicas: [1]
Drag options to blanks, or click blank then click option'
A10
B0
C2
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Setting replicas to 0 means no containers run.
Setting replicas to 10 or 5 is too large for a canary.
3fill in blank
hard

Fix the error in the Docker command to update the canary container with a new image version.

Docker
docker container [1] canary_app myapp:canary_v2
Drag options to blanks, or click blank then click option'
Aupdate
Bexec
Crun
Drestart
Attempts:
3 left
💡 Hint
Common Mistakes
docker container update does not update the image used by the container.
docker container run creates a new container, not update existing.
docker container exec runs a command inside a running container.
4fill in blank
hard

Fill both blanks to create a Docker Compose snippet that routes 10% of traffic to the canary service using labels.

Docker
services:
  app_canary:
    image: myapp:canary
    deploy:
      replicas: 2
      labels:
        - "traefik.weight=[1]"
  app_stable:
    image: myapp:stable
    deploy:
      replicas: 8
      labels:
        - "traefik.weight=[2]"
Drag options to blanks, or click blank then click option'
A1
B9
C10
D90
Attempts:
3 left
💡 Hint
Common Mistakes
Using weights that do not add up proportionally to 100.
Assigning higher weight to canary than stable.
5fill in blank
hard

Fill all three blanks to define a Docker Compose healthcheck that retries 3 times with 5 seconds interval for the canary service.

Docker
services:
  app_canary:
    image: myapp:canary
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost/[1]"]
      interval: [2]s
      retries: [3]
Drag options to blanks, or click blank then click option'
Ahealth
B10
C3
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong endpoint path in test command.
Setting interval or retries to zero or too high values.