- [Instructor] To find out what storage driver
you are currently using you can do a docker space info
and I typically pipe that to more
because the output can be rather long.
And on the very first page you'll find the storage driver
that you're currently running.
In this case it's overlay2,
and it's backed by an ext file system.
So how do we change the storage driver?
Let's quit here and actually go over
to the docker documentation.
And in the documentation you'll find
that there are specific pages for each
of the different storage drivers.
For example right now we're on the OverlayFS storage driver.
The OverlayFS storage driver page here
tells us that docker provides two storage drivers
for OverlayFS.
They are overlay and the newer and more stable overlay2.
So let's say that we wanted to change from overlay2
to just overlay.
If we scroll on down it tells us that overlay is allowed
but not recommended in Docker CE
and scrolling on down further it walks us through the steps
to change our storage driver.
For example first we'll do a sudo and a systemctl
to stop docker.
We'll back up the contents of our live docker
and then in the etc docker daemon.json file
we'll add in the storage driver configuration
if it's not in there already.
Let's give it a try.
First, we'll do a sudo systemctl
stop docker.
Next, it's very highly recommended
that you do a sudo and you copy
the entire var/lib/docker folder
to somewhere like $HOME,
to make a backup of your docker directory.
We're going to save a little bit of time
by not doing that right now.
I've already backed up my docker directory.
And then what we need to do is to edit,
I'm going to use nano to do it,
etc/docker/daemon.json.
And you can see by default here
we don't have any storage driver configuration,
so what we need to do is
to add a new storage driver entry here,
and we'll specify the new storage driver
that we want to be used here.
After that we can save the configuration changes.
In this case I'm going to say no,
and then we would restart
our docker daemon.
But if you think back to the big red gotcha
in the docker documentation concerning the storage driver,
the most important thing to remember is
if you change your storage driver you will lose access
to all your existing images that were created
with the original storage driver.
So in my case, I'll be honest,
I don't wanna change my storage driver
because I'll lose access to all my images.
So before you make a change to a new storage driver
make sure that you take that into consideration.
We'll work more with storage drivers later in the course.