Deploying containers with persistent storage in VMware environments

In my last blog post I described how to install the VMware Plugin for Docker.  Now we will deploy an environment and show how we can use a persistent storage volume across containers.

Build a new volume for a container

docker volume create –driver-vmdk –name BusyBox1 -o size=2gb


You can check the volume with docker volume ls or docker volume inspect  commands.

Create a container with persistent storage

docker run –rm -it -v Volumename:/mnt/mymount containerimage.

docker run –rm -it -v BusyBox1:/mnt/myvol busybox


Create a file in the persistent storage

In your container go to the directory you specified in the previous command. In our case it is /mnt/myvol

Create a quick file ex: touch file1  and then add some information to it.


We have created a file in the persistent storage not in the container file system.

Now you can exit your container. ex: exit

Create a different container and attach the persistent volume

I will download a new image for an Ubuntu:latest container and mount the persistent storage volume.

docker run –rm -it -v BusyBox1:/mnt/myvol ubuntu


Change to the same directory /mnt/myvol and see that you can browse the file was created before.

Why is this important? 

This allows the developers or administrators to provide a persistent storage that can be used across container reboots to save data outside the container. This can be a great use case for database or shared data that can be used for different containers.


Drop me a comment if you like this type of post.

Subscribe For Latest Updates

Sign up for best of digital marketing, livestream and technology opinions on what matters to you.

Invalid email address
We promise not to spam you. You can unsubscribe at any time.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: