Windows Server 2016 – Docker create and remove data volume

You can create a volume for a container if you want the data to be available across containers. Even if you delete the container, the data volume will remain on the container host.

Create a new volume

volume create my-vol

, <span>Windows Server 2016 – Docker create and remove data volume</span>, KandZ

Find information about the volume you created

docker volume inspect my-vol

, <span>Windows Server 2016 – Docker create and remove data volume</span>, KandZ

Then run the container

docker run -d --name test --mount source=my-vol,target=c:\data microsoft/nanoserver

, <span>Windows Server 2016 – Docker create and remove data volume</span>, KandZ

the directory data in the container must exist.

check the information for the container. Look for the mounts section.

docker inspect test

, <span>Windows Server 2016 – Docker create and remove data volume</span>, KandZ

, <span>Windows Server 2016 – Docker create and remove data volume</span>, KandZ

 

If you want to remove a data volume

docker volume rm my-vol

More information about volumes here.

32960cookie-checkWindows Server 2016 – Docker create and remove data volumeWindows Server 2016 – Docker create and remove data volume

Related posts