FahamLah

Commands

docker volume create|ls|inspect|rm

docker volume create|ls|inspect|rm <name>

Risk: Careful

What it does

Manages volumes: lockers that keep data after containers go.

When to use it

For databases and anything you must not lose.

Example

$ docker volume create pgdata

Make a locker called pgdata.

$ docker volume ls

List your lockers.

$ docker volume rm pgdata

Delete a locker and its data. Careful!

$ docker volume inspect pgdata

Where the locker lives, and when it was made.

$ docker run --rm -v pgdata:/from -v "$PWD":/to alpine:3.22 tar czf /to/backup.tar.gz -C /from .

Back up a locker into one file here.