Docker Create Volume

In this quick guide, we're diving deep into the art of creating Docker Volumes, ensuring you have the hands-on knowledge required for effectively managing containerized application data. 

Why Create Docker Volumes? 

Data Persistence: Ensure data survives container terminations. 

Performance: Volumes offer better I/O performance than other data storage methods in Docker. 

Sharing Data: Facilitates data sharing between containers. 

Backup and Migration: Easily back up or migrate data outside the container ecosystem. 

Creating a Docker Volume

Use the following command to create a Docker Volume:

docker volume create VOLUME_NAME

For instance, to create a volume named my_data_volume:

docker volume create my_data_volume



The command's output confirms the creation by echoing back the name of the volume.

If a name is not specified, Docker generates a random name:

$ docker volume create  

Adding More Layers: Advanced Options

Docker offers several options to customize volume creation. 

Specify a Driver: 

Docker volumes can be created using various drivers. The default is local, but others like nfs or those provided by storage solutions like NetApp or EMC can be used.

$ docker volume create --driver=DRIVER_NAME my_custom_volume

Add Labels: 

Labels are a way to add metadata to your volumes.

$ docker volume create --label project=sample_project my_labeled_volume

Use Volume Options: 

Depending on the driver used, you can provide specific options. For instance, with the local driver, you can specify the location on the host:

$ docker volume create --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 my_opt_volume

Verifying Your Creation

After creating a volume, you can verify its existence using:

docker volume ls

This command lists all volumes present on the Docker host.


In this guide, we have learned how to create a Docker volume, how to create a Docker volume with different options, and how to verify the created volume.

Related Volume Management Guides