Complete the Docker command to run a container with a specific image tag for canary deployment.
docker run -d --name canary_app [1] myapp:canaryThe -p 8080:80 option maps port 8080 on the host to port 80 in the container, allowing access to the canary deployment.
Complete the Docker Compose service definition to deploy a canary version of the app with limited replicas.
services:
app_canary:
image: myapp:canary
deploy:
replicas: [1]Setting replicas to 2 allows a small portion of traffic to be served by the canary version, which is typical for canary deployments.
Fix the error in the Docker command to update the canary container with a new image version.
docker container [1] canary_app myapp:canary_v2The docker container restart command restarts the container, which is needed after updating the image locally to apply changes.
Fill both blanks to create a Docker Compose snippet that routes 10% of traffic to the canary service using labels.
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]"Setting traefik.weight=1 for canary and traefik.weight=90 for stable routes roughly 10% traffic to canary and 90% to stable.
Fill all three blanks to define a Docker Compose healthcheck that retries 3 times with 5 seconds interval for the canary service.
services:
app_canary:
image: myapp:canary
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/[1]"]
interval: [2]s
retries: [3]The healthcheck tests the /health endpoint, retries 3 times, and waits 5 seconds between attempts to ensure the canary is healthy before routing traffic.