How to create volume in Docker using Command



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

Example:
% docker volume create c_drive
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,

Example:
% docker volume ls
DRIVER    VOLUME NAME
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 is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

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