Ad space (banner)
AD

Got the fundamentals? A structured Docker course is a fast way to level up.

Find Docker courses on Udemy

Affiliate link. Costs you nothing extra.

🐳Docker Lessons
Lesson 38 / 45

Creating a Volume with docker volume create

When you want a managed place for data to persist, use docker volume create. It creates a named volume that Docker looks after.

The syntax is docker volume create name. Docker stores the data in its own area, so you don't have to pick a host path.

Running docker volume create data creates a volume named data, which containers can mount with -v data:/path.

A common stumble is not distinguishing named volumes from bind mounts. Named volumes are managed by Docker and portable; bind mounts tie you to a specific host directory.

In real work, named volumes are the normal choice for database storage.

Docker
Try it (type this into the pseudo terminal)
docker volume create data

🧑‍💻 You can type this command into the Docker pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)