Bird
0
0

You want to automate cleanup but keep volumes. Which command removes all stopped containers and unused images but preserves volumes?

hard📝 Application Q9 of 15
Docker - Resource Management
You want to automate cleanup but keep volumes. Which command removes all stopped containers and unused images but preserves volumes?
Adocker system prune --filter "until=24h"
Bdocker system prune --volumes=false
Cdocker system prune --volumes
Ddocker system prune -v
Step-by-Step Solution
Solution:
  1. Step 1: Understand pruning with volume preservation

    By default, docker system prune does not remove volumes unless --volumes is specified.
  2. Step 2: Use explicit flag to preserve volumes

    Using --volumes=false ensures volumes are not removed during prune.
  3. Final Answer:

    docker system prune --volumes=false -> Option B
  4. Quick Check:

    Preserve volumes by setting --volumes=false [OK]
Quick Trick: Add '--volumes=false' to keep volumes during prune [OK]
Common Mistakes:
  • Assuming volumes are always removed by default
  • Using '--volumes' flag which removes volumes
  • Not using the force flag when needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes