---
title: "Effortlessly Create Docker Volumes on Windows"
description: "Step-by-step guide to creating Docker volumes in Windows, complete with an informative video tutorial."
canonical: "https://adamtheautomator.com/create-docker-volume/"
---

# Effortlessly Create Docker Volumes on Windows

> Step-by-step guide to creating Docker volumes in Windows, complete with an informative video tutorial.

Source: https://adamtheautomator.com/create-docker-volume/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Effortlessly Create Docker Volumes on Windows](https://adamtheautomator.com/wp-content/uploads/2019/07/photo-1494961104209-3c223057bd26.jpg)

# Effortlessly Create Docker Volumes on Windows

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)25 July 20195 min. read

Categories: [DevOps](/category/devops/)

Tags:[Docker](/tag/docker/)

Table of Contents

*   [Storing Persistent Data](#storing-persistent-data)
*   [Enumerating Data in Docker Volumes](#enumerating-data-in-docker-volumes)
*   [Creating Docker Volumes](#creating-docker-volumes)
*   [Inspecting Docker Volumes](#inspecting-docker-volumes)
*   [Deleting Docker Volumes](#deleting-docker-volumes)
*   [Summary](#summary)

Docker volumes are the preferred way of handling persistent data created by and used by Docker containers. Let’s take a look at how this works by covering how to create Docker volumes on Windows. You’ll also learn how to manage them too!

Not a reader? Watch this related video tutorial!

**_Not seeing the video? Make sure your ad blocker is disabled._**

Related:[Deploying your First Container with Docker for Windows](https://adamtheautomator.com/docker-windows/)

> _This blog post has a companion video created by [TechSnips contributor, Matt McElreath](https://techsnips.io/contributors/matt-mcelreath/). Feel free to have a watch or, if you prefer text, read on!_

## Storing Persistent Data

If you want to store persistent data for containers, there are a couple of options. First, I’ll show you how to use a _bind mount_. I’m currently in a folder called _data_ on my _C:\\_. If I list the contents of this folder, you can see that I have five text files.

![Multiple text files in the C:\\data folder](/wp-content/uploads/2019/07/img_5bb8df69d80e6.png)

Multiple text files in the C:\\data folder

If I want to make this folder available to a container, I can mount it when starting the container.

Let’s go ahead and run a container using `docker run`. I’m going to run this container in interactive mode, then specify `-V`. Here, I’m going to put the path to my data folder, followed by a colon, then I will specify the path inside the container where I would like this folder to be mounted.

For this, I’m going to specify the _C:\\shareddata_ folder. Then I’ll specify the Windows server core [image](https://adamtheautomator.com/docker-build-tag/) and finally, I’ll specify that I want to run PowerShell once I’m inside the container.

```powershell
docker run -it -v c:\Data:c:\shareddata microsoft/windowsservercore powershell
```

Now that I’m inside the new container, if I list the contents of _C:\\_, you can see that I have a _shareddata_ folder.

![Listing directory contents in a Docker container](/wp-content/uploads/2019/07/img_5bb8e02b3ed89.png)

Listing directory contents in a Docker container

Let’s go into that folder and list the contents. Here are my five test files that are located on my container host.

![Files on the host](/wp-content/uploads/2019/07/img_5bb8e0450ebc4.png)

Files on the host

I can also create files in this folder, which will be available to other containers or my container host. Let’s go ahead and run a new item to create a file called _containertest_.

![Creating a file on the container host](/wp-content/uploads/2019/07/img_5bb8e06699010.png)

Creating a file on the container host

We can see above that the new file has been created from within the container. Now I’ll exit this container which will shut it down by running `exit`.

If I run `docker ps`, you can see that there are currently no running containers.

![Looking for running containers](/wp-content/uploads/2019/07/img_5bb8e098893cd.png)

Looking for running containers

## Enumerating Data in Docker Volumes

Now let’s list the contents of the data folder again from my container host.

![Listing files on the container host](/wp-content/uploads/2019/07/img_5bb8e0aa046f3.png)

Listing files on the container host

We can see the new file that was created from inside the container called _containertest_. Bind mounts have some limited functionality, however, so volumes are the preferred way to accomplish what we are trying to do. To get started with volumes, we can run the same command to start up a container, but this time with a couple of small differences. Where we specified the volume, instead of using the path on the container hosts’ file system, I’m going to use the word _hostdata_ as the name of a volume I want to create and use.

From inside the new container, if I list the contents of _C:\\_, you can see again that I have a folder called _shareddata_.

![Listing files](/wp-content/uploads/2019/07/img_5bb8e0cdce504.png)

Listing files

If I list the contents of that folder, it is currently empty because we created a blank volume. Now let’s run _Ctrl-P-Q_ which will take us out of the running container, but keep it running in the background.

From the container host, run `docker volume ls`. This will list the current volumes on this container host. I have a volume called _hostdata_, which was created when I specified it in the `docker run` command.

![Listing Docker volumes](/wp-content/uploads/2019/07/img_5bb8e0e46c090.png)

Listing Docker volumes

If I run `docker ps` we can see our running container.

![Listing running containers](/wp-content/uploads/2019/07/img_5bb8e0f480e23.png)

Listing running containers

Stop that container using `docker stop`. Now we have no running containers.

![Stopping a Docker container](/wp-content/uploads/2019/07/img_5bb8e10b818a9.png)

Stopping a Docker container

Related:[How to Stop Docker Containers Without Screwing Things Up!](https://adamtheautomator.com/docker-stop-containers/)

Remove the stopped containers by running `docker rm`. If I list the volumes again, you can see that the _hostdata_ volume is still available and can be mounted to new containers.

![Listing Docker volumes](/wp-content/uploads/2019/07/img_5bb8e12a79541.png)

Listing Docker volumes

## Creating Docker Volumes

Another way to create a volume is to use the `docker volume create` command. If you don’t specify a name, docker will give it a name which is a long list of random characters. Otherwise, you can specify a name here. I’m going to call this volume _logdata_. Now we can see it is in the list when we list the volumes again.

![Creating a new Docker volume](/wp-content/uploads/2019/07/img_5bb8e13cdbd4c.png)

Creating a new Docker volume

You’ll now mount that to a new container. Use `docker run` again and for the volume specify the volume that just created and mount it to _c:\\logdata_.

```bash
> docker run -it -v logdata:c:\logdata microsoft/windowsservercore powershell
```

From inside the container, go into the _logdata_ folder and create a couple of files. Right now, there are no files in this directory, so go ahead and create some.

```powershell
PS> New-Item -Name Log1.txt -ItemType File
PS> New-Item -Name Log2.txt -ItemType File
```

Now I have two log files in this directory.

![Two files in C:\\logdata](/wp-content/uploads/2019/07/img_5bb8e219e105d.png)

Two files in C:\\logdata

Run _Ctrl-P-Q_ again to exit this container while it is still running. While that container’s running, start up a new container with the same volume mounted.

```bash
> docker run -it -v logdata:c:\logdata microsoft/windowsservercore powershell
```

If we run a listing on the _logdata_ folder in the new container we can see the two log files being shared.

![Two log files being shared with containers](/wp-content/uploads/2019/07/img_5bb8e27a16d3f.png)

Two log files being shared with containers

Now, exit this container. You should still have one running container and two exited containers.

![Two containers still running](/wp-content/uploads/2019/07/img_5bb8e28cbdc4e.png)

Two containers still running

Now stop all running containers, then run `docker rm` to remove all exited containers.

![Removing Docker containers](/wp-content/uploads/2019/07/img_5bb8e2aab1168.png)

Removing Docker containers

List the volumes again. The _logdata_ volume is still available to be mounted to future containers.

![Volume still available](/wp-content/uploads/2019/07/img_5bb8e2be275a8.png)

Volume still available

If you run run `docker volume`, you’ll get some usage help for the command.

![Docker volume syntax](/wp-content/uploads/2019/07/img_5bb8e2d0d7edd.png)

Docker volume syntax

## Inspecting Docker Volumes

We already looked at `create`, so let’s move on to `inspect`. If I run `docker volume inspect` against the _logdata_ volume, it will return the properties for that volume, including the mount point which is the physical path to the volume on the container host.

![Inspecting Docker volumes](/wp-content/uploads/2019/07/img_5bb8e2e81ff68.png)

Inspecting Docker volumes

Let’s open that folder using `Invoke-Item` and have a look. Under the _logdata_ folder, there’s a folder called __data__. If we open that, we can see the files that were created from the container earlier.

![Files created earlier](/wp-content/uploads/2019/07/img_5bb8e2ff89966.png)

Files created earlier

## Deleting Docker Volumes

To delete a volume, we can run `docker volume rm`, followed by the name of the volume you want to delete.

```bash
> docker volume rm logdata
```

Now if I list the volumes, _logdata_ is no longer there.

![Listing Docker volumes](/wp-content/uploads/2019/07/img_5bb8e339b2ffa.png)

Listing Docker volumes

Finally, we can use `prune` to remove all unused local volumes. This will delete all volumes that are not mounted to a running or stopped container.

![Inspecting the prune parameter](/wp-content/uploads/2019/07/img_5bb8e351ae9c7.png)

Inspecting the prune parameter

You want to be careful with this command, so there’s a warning and a prompt to make sure that you are sure that you want to do this. If I type `Y` and hit enter, it will show me which volumes were deleted.

And if I list my volumes again you can see that they have all been deleted.

![No Docker volumes exist](/wp-content/uploads/2019/07/img_5bb8e389760db.png)

No Docker volumes exist

## Summary

In this blog post, you should have gotten a good overview of managing Docker volumes in Windows. Docker is a great container platform. With its support for Windows and your newfound skills at managing Docker volumes, you will be unstoppable!

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fcreate-docker-volume%2F&text=Effortlessly%20Create%20Docker%20Volumes%20on%20Windows)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fcreate-docker-volume%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fcreate-docker-volume%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/02/featured_image-13.webp)

### [Azure Container Apps: Instant Preview Environments per PR](/build-ephemeral-preview-environments-every-pr/)

Build isolated preview environments for every pull request using Azure Container Apps revision labels and Azure DevOps pipelines with scale-to-zero economics.

![](https://adamtheautomator.com/wp-content/uploads/2025/11/55418e927e511ae263219c072e27d637c2a967a5036de7020b329582db775c26.png)

### [Automating Docker Container Health Checks with Python and Local Notifications](/docker-health-checks-python/)

Docker's built-in health checks are passive—they tell Docker when a container fails, but do they tell you? In this tutorial, we'll build a lightweight Python monitoring system that runs entirely on your infrastructure with zero external dependencies. You'll learn to detect container failures in real-time, send instant alerts, and maintain a complete audit log of every state change.

![](https://adamtheautomator.com/wp-content/uploads/2023/07/gitea-docker.jpg)

### [Gitea Docker: Your Ultimate Self-Hosted Git Solution](/gitea-docker/)

Learn how to install a Gitea Docker instance and self-host Git repositories securely in this ATA Learning tutorial!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
