Docker Community Forums

Share and learn in the Docker community.

[SOLVED] Unable to change Docker base path

Hello :slight_smile:

It’s days now i’m trying to change my docker base path to a new location but without any success.

I’m on OpenMediaVault on an ODROID HC2.

I followed different guides:

1.How do I change the Docker image installation directory?

But nothing, after the changes, i go back to OMV gui and no container is running… i do not understand why.

I have copied the content of /var/lib/docker to my new desired location, that’s /srv/dev-disk-by-label-HC2/DockerBasePath/docker

Could be the difference of filesystems? /var/lib/docker is on a MicroSD with btrfs and my HD is ext4.

Any idea? Thanks for your time!

EDIT: After editing the daemon.json file with:

"data-root": "/srv/dev-disk-by-label-HC/DockerBasePath/docker",
"storage-driver": "overlay2"

i tried the command: docker info | grep 'Docker Root Dir' and the output is correct " Docker Root Dir: /srv/dev-disk-by-label-HC/DockerBasePath/docker "

So why it’s not working? As soon as i rename my original docker to docker.old i do not see anything into OMV, and docker ps shows nothing running.

Yep. Compare the output of docker info | grep Storage. You should see that on the old btrfs data-root the storage driver btrfs is used, while on the new ext4 data-root the storage driver Overlay2 is used (if your os supports it)

Thank you!

Did it right now:

root@odroidxu4:~# docker info | grep Storage
 Storage Driver: btrfs


root@odroidxu4:~# docker info | grep Storage
 Storage Driver: overlay2

I remember that using only data-root in the json files gave me errors when trying to start docker. That’s why i added the overlay option.

So there is a way i can let this work?

If the storage driver is changed your images and containers will be “lost”.
Docker leverages the storage driver to provide its space saving image layer handling.

Basicly your installation will behave like a clean installation.

Anyway, I am still not sure what your problem ist. Can’t you deploy new container? Can’t you pull new images?

I wanted to use the same containers i had on the microsd. I have not tried to pull new images etc. Was expecting to see my old containers show up.

You will need to let go either of moving data-root to a path with different storage driver, or of your expectation that ontainers will be available after switching the stroge driver.

But if I recreate my containers into the new path, can they point to their /config and /data dir that i was using before?

EDIT: Yes, and worked fine :slight_smile:

Thanks @meyay!!

Just download image from has the flexibility of letting you decide where to store the image