Skip to content

A modular automation tool to relocate Docker data to home directory or any custom location.

Notifications You must be signed in to change notification settings

Hasib-4174/dockermove

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐳 dockermove

A simple modular automation tool to install and move Docker's data root directory to your $HOME or any custom location.


πŸ’‘ Why It's Useful

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.


πŸ“ Directory Structure

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

✨ Features

  • Detects package manager automatically (apt, pacman, dnf, yay, paru)
  • Installs or updates Docker if already installed
  • Relocates all Docker data from /var/lib/docker to $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

πŸš€ Usage

git clone https://github.com/Hasib-4174/dockermove.git
cd dockermove
chmod +x dockermove.sh scripts/*.sh
./dockermove.sh

βš™οΈ Requirements

  • Linux system with sudo privileges
  • Active internet connection (for installing or updating Docker)
  • Enough storage space in $HOME or the target directory

🧭 Example Output

πŸš€ 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!

πŸ› οΈ Future Improvements

  • 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

πŸ“ License

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.

About

A modular automation tool to relocate Docker data to home directory or any custom location.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages