How to Move Docker’s var/lib/docker to a New Disk?

0
6
Asked By CuriousCat123 On

I recently set up Docker on a Proxmox Ubuntu server VM and quickly ran into issues with running out of space after creating a few stacks. To tackle this, I added a new disk to my Ubuntu server VM with 100 GB of space, given that it's on a NAS. Now, I'm trying to figure out the best way to move the var/lib/docker directory to this new disk. Should I do this during the Docker setup or after it's already running? What steps should I follow to do this properly? Thanks!

3 Answers

Answered By HelpfulUser987 On

You can easily stop Docker, then move all the files from the current location to the new disk. After that, just mount it to the var/lib/docker directory. It’s pretty straightforward!

Answered By TechSavvyGal On

Instead of creating a separate var/lib/docker, consider resizing the filesystem. I usually avoid multiple virtual disks in VMs and use LVM for better management of filesystems.

Answered By DiskMover99 On

A clean way to handle this is to edit the /etc/docker/daemon.json file. Set the 'data-root' to your new disk location. Just remember to stop the Docker service before moving the files; otherwise, you'll run into issues.

CuriousCat123 -

Thanks for the tips! I'll definitely follow that approach.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.