Docker Ep 17: Bind Mount — Instant code refresh from local

Which Problem Bind Mount Fixes?

Introducing Bind Mounts

Implementing Bind Mount in Node.js Application:

docker volume ls
-v "<project-root-path>:/<docker-root-path>" // ADDITIONAL BindMount
docker run -d -p <webport>:<dockerport> --rm 
--name <container-name>
-v <named-volume-name>:<path-for-sharing>
-v "<project-root-path>:/<docker-root-path>" // BIND MOUNT
<image-name:tag>
eg.
docker run -d -p 3000:80 --rm --name feedback-app -v feedback-may28:/app/feedback -v "/Users/amirmustafa/Development/Projects/Docker-Node:/app" feedback-node:volumes
http://localhost:3000
docker logs <container-name or container-id>eg. docker logs feedback-app
-v "/Users/amirmustafa/Development/Projects/Docker-Node:/app" feedback-node:volumes

Solution:

-v <file-to-ignore> <image-name:tag>
-v /app/node_modules feedback-node:volumes
docker run -d -p 3000:80 --rm --name feedback-app -v feedback-may28-2022:/app/feedback -v "/Users/amirmustafa/Development/Projects/Docker-realtime-node/:/app" -v /app/node_modules feedback-node:volumes
http://localhost:3000

Some Points:

Video:

Closing Thoughts:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store