- [Instructor] The preferred way to store persistent data
with docker containers is to use what they call a volume.
You can manage docker volumes with the CLI,
with the docker API, they work in Linux,
they work in Windows, they can be shared safely
among multiple containers.
And with docker volume drivers
you can even store you volumes on remote hosts
or Cloud providers, even encrypt the contents.
And new volumes can have their content pre-populated
by a container.
So you have a number of benefits to using volumes
over all of the other alternatives,
and that's one of the many reasons
that volumes are preferred if you need to persist data.
If we scroll on down the docker documentation covers
how to create a volume with docker volume create,
how to list volumes, docker volume ls,
how to inspect volumes with docker volume inspect,
even remove volumes with docker volume rm.
It also covers how to start a container with a volume,
using docker run, specifying the dash dash mount option
for the name of the volume.
Or you can use the minus v option for the name
of the volume as well.
You can even start services with volumes.
So let's say that I wanna bring up a service
that has 10 replicas, for example.
All of those replicas could mount the same volume
to store their persistent data.
So that's very beneficial in production environments.
With all of this in mind, I'd like to jump over
into the lab environment and show you
how to do some of the things that we just reviewed
from the docker documentation.