How to create volume in Docker using Command

To create a volume using Docker Command Line make use of the docker volume create command,

% docker volume create c_drive
docker volume create command

To see a list of all volumes created using the docker volume command, make use of the ls command,

% docker volume ls
local     c_drive
local     d_drive
local     e_drive

Note: If you use special characters other than a dot(.) or dash (-) you will get an error,

% docker volume create c:
Error response from daemon: create c:: "c:" 
includes invalid characters for a local volume name, 
only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. 
If you intended to pass a host directory, 
use absolute path

This is not an AI-generated article but is demonstrated by a human on an M1 Mac running macOS Sonoma 14.0.

Please support independent contributors like Code2care by donating a coffee.

Buy me a coffee!

Buy Code2care a Coffee!

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap