Bird
0
0

Which of these is the correct syntax to mount the current directory into the container at /app?

easy📝 Syntax Q3 of 15
Docker - in CI/CD
Which of these is the correct syntax to mount the current directory into the container at /app?
A-v /app
B-v /app:$(pwd)
C-v $(pwd)
D-v $(pwd):/app
Step-by-Step Solution
Solution:
  1. Step 1: Understand volume mount syntax

    The syntax is -v host_path:container_path. To mount current directory to /app, use -v $(pwd):/app.
  2. Step 2: Check other options

    Options B, C, and D have reversed or incomplete syntax, so they are incorrect.
  3. Final Answer:

    -v $(pwd):/app -> Option D
  4. Quick Check:

    Volume mount syntax = host:container [OK]
Quick Trick: Volume mount format: -v host_path:container_path [OK]
Common Mistakes:
  • Reversing host and container paths
  • Omitting container path
  • Using incomplete volume syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes