Bind Mount connects your local PC folder directly to a container folder. The container reads files from your PC and any changes reflect instantly — no image rebuild needed.
Used mainly during development when you are making frequent code changes and do not want to rebuild the image every time.
Every code change requires a full rebuild:
# Change 1
docker build -t myapp:v1 .
docker run myapp:v1
# Change 2 — have to rebuild
docker build -t myapp:v2 .
docker run myapp:v2
# Change 3 — rebuild again
docker build -t myapp:v3 .
docker run myapp:v3
Every small change means waiting for a full build. Slow and annoying during development.
docker run -it -v C:\\Users\\DakshSaini\\testapp:/app <image-id>
Now:
docker run -v <local_folder>:<container_folder> <image_id>
Examples:
# Mount project folder to /app inside container
docker run -it -v C:\\Users\\DakshSaini\\testapp:/app 805c37445902
# Using image name instead of ID
docker run -it -v C:\\Users\\DakshSaini\\testapp:/app daksh12398/testingapp:01
# Run a specific file
docker run -it -v C:\\Users\\DakshSaini\\calculator:/app 805c37445902 python /app/calc.py