Mount local volumes in your Windows and Linux containers

Photo by Guillaume Bolduc on Unsplash

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
Mount volume on docker Linux

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

Folder to be mounted
Mount volume on docker Windows

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!




Software developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Mapping Functions in Cache Memory

Cache memory image

What Makes Google Trust Dart Programming Language?

Crop and Swap 2 images using Python

The Life-improving power of coding and diversity

Steering Clear of Oracles

Palette swapping with runtime palette generation

Treasure Is In Your Student Email

Google Maps Place Results API and the `data` parameter

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
Tauseef Malik

Tauseef Malik

Software developer

More from Medium

How to copy Docker images from one host to another without using a repository?

How to load the CSV data to PostgreSQL via dbt (Data Build Tool)

Modernising Post Trade Settlements with AWS and Red Hat OpenShift

SFTP User To Access S3 Bucket