Docker Volume Basics
Volumes are the preferred method of maintaining persistent data in Docker. In this lesson, we will begin learning how to use the volume subcommand to list, create, and remove volumes.
Step 1: List all Docker volume commands:
docker volume --helpcreate: Create a volume.
inspect: Display detailed information on one or more volumes.
ls: List volumes.
prune: Remove all unused local volumes.
rm: Remove one or more volumes.
Step 2: List all volumes on a host:
docker volume lsStep 3: Create two new volumes:
docker volume create test-volume1docker volume create test-volume2Step 4: Get the flags available when creating a volume:
docker volume create -hStep 5: Inspecting a volume:
docker volume inspect test-volume1Step 6: Deleting a volume:
docker volume rm test-volume1Removing all unused volumes:
docker volume pruneLast updated