Bird
0
0

Given the following commands, what will be the output of docker ps after switching traffic to green?

medium📝 Command Output Q4 of 15
Docker - Production Patterns
Given the following commands, what will be the output of docker ps after switching traffic to green?
docker run -d --name blue_app app:v1
docker run -d --name green_app app:v2
docker stop blue_app
docker start green_app
ANo containers are running
BBoth blue_app and green_app containers are running
COnly green_app container is running
DOnly blue_app container is running
Step-by-Step Solution
Solution:
  1. Step 1: Analyze container states after commands

    blue_app is stopped, green_app is started and running.
  2. Step 2: Understand docker ps output

    docker ps shows running containers only, so only green_app appears.
  3. Final Answer:

    Only green_app container is running -> Option C
  4. Quick Check:

    Stopped containers do not show in docker ps [OK]
Quick Trick: docker ps shows only running containers [OK]
Common Mistakes:
  • Assuming stopped containers appear in docker ps
  • Thinking both containers run simultaneously after stop
  • Confusing docker start with docker run

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes