A simple modular automation tool to install and move Docker's data root directory to your $HOME or any custom location.
By default, Docker stores all images, containers, and layers in /var/lib/docker.
On systems with limited root (/) partition space β such as minimal Linux installs, VMs, or laptops with small SSDs β this can quickly fill up your root drive and cause system instability.
dockermove solves this by:
- Relocating Docker's data to your home directory (or any other path, like
/mnt/storage/docker). - Automating the entire setup process: install, stop, clean, configure, and restart Docker.
- Making it modular, so each step can be customized or reused in other automation projects.
This tool is ideal for developers or power users running Docker on lightweight systems, dual-boot setups, or cloud VMs with small root partitions but large home volumes.
dockermove/
βββ scripts/
β βββ 00-check-package-manager.sh
β βββ 01-install-docker.sh
β βββ 02-stop-docker.sh
β βββ 03-clear-old-docker.sh
β βββ 04-setup-new-root.sh
β βββ 05-permissions.sh
β βββ 06-enable-docker-user.sh
β βββ 07-restart-verify.sh
β βββ utils.sh
βββ dockermove.sh
βββ README.md
- Detects package manager automatically (
apt,pacman,dnf,yay,paru) - Installs or updates Docker if already installed
- Relocates all Docker data from
/var/lib/dockerto$HOME/.docker-root - Cleans up existing Docker cache safely
- Sets up permissions and Docker group for user access
- Verifies that Docker is running with the new data root directory
git clone https://github.com/Hasib-4174/dockermove.git
cd dockermove
chmod +x dockermove.sh scripts/*.sh
./dockermove.sh- Linux system with
sudoprivileges - Active internet connection (for installing or updating Docker)
- Enough storage space in
$HOMEor the target directory
π Docker Relocation Automation Started
πΉ Detecting Package Manager
β
Detected package manager: apt
πΉ Installing or Updating Docker
Docker not found, installing...
πΉ Setting Up New Docker Root
π Created ~/.docker-root
πΉ Restarting and Verifying
Docker Root Dir: /home/username/.docker-root
β
Docker has been successfully relocated!
- Add Python-based version with config file (JSON/YAML)
- Add CLI flags (e.g.,
--path,--dry-run) - Add rollback feature to revert to default
/var/lib/docker
This is open-source project
Feel free to use, modify, and share it.
π¬ Made for developers who want to save root space and keep Docker clean & modular.