Bird
0
0

Which command correctly builds a Docker image named myapp with squashed layers using the Docker CLI?

easy📝 Syntax Q3 of 15
Docker - Image Optimization
Which command correctly builds a Docker image named myapp with squashed layers using the Docker CLI?
Adocker build -squash -t myapp .
Bdocker build --squash -t myapp .
Cdocker build --squash=true -t myapp .
Ddocker build -squash=true -t myapp .
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct flag syntax

    The correct flag for squashing is --squash (double dash, no equals sign).
  2. Step 2: Confirm command structure

    The tag option -t myapp and context . are standard.
  3. Final Answer:

    docker build --squash -t myapp . -> Option B
  4. Quick Check:

    Double dash and no equals sign for flags [OK]
Quick Trick: Use double dash --squash without equals sign [OK]
Common Mistakes:
  • Using single dash for --squash
  • Adding =true after --squash
  • Misplacing the tag option

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes