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.

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]OPTIONS
--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

Example:

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

Arctos Biweekly Report: Oct 25th — Nov 7th

How to use Flutter with SQLite

Since C++11, the standard provides amazing futures to implement relatively simple and high optimal…

Data Flow: How does data travel through Terra

Triton Service Nodes are now on the Public Testnet!

An in-depth look at 100% Zero Downtime deployments with Terraform | Checkly

NOTYPE1 by NuFava Rae Sremmurd http://flic.kr/p/q2Q3Cz

Drupal Deep Dives: Ignoring Your Slaves

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

About Version Control

Auto enable tap-to-click on Surface Pro 4 after suspend with libinput

re-enable from mouse setting menu

Basic Linux Commands