Mount local volumes in your Windows and Linux containers

Docker containers

Many of the organizations now use containerization technologies to rapidly deliver software. Gone are those days, when a developer had to setup and configure the entire product on a specifically compatible version of operating system with bunch of other per-requisites. Containerization has definitely gained pace over the year and so has Docker, a name so synonymous to containers. No not the containers found in dockyards :)

If you are familiar to using container, then at some point in time, you definitely had to use mounted volumes/drives in your running image container. So let’s jump into how you can mount volume in your container

The docker command to mount volumes in windows or linux image containers is more or less the same with subtle differences.

--volume , -v Bind mount a volume

While running the container we just need to specify the volume flag and the binding local-machine-path:container-path


docker run -v /home/user/mount:/usr/share/nginx/html nginx:latest

On windows, in a similar fashion we can mount the local volume however notice the highlighted syntax for path bindings which is somewhat different than regular windows styled path

This is how we can use local volumes to perform some of the daily tasks during development using containers. However, for production usages an orchestrator like Kubernetes, swarm etc. will use persistent volume claims to assign storage as per requirement and abstracts away the need to know underlying storage infrastructure, that could be NFS or a cloud-provider-specific storage system. More on that in upcoming articles. Thanks for reading!



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