Operations helper

docker-data-move.sh

Bundled from the tool-tl/docker-data-move.sh project and republished through helper.sh for direct execution, operational handoff, and multilingual documentation.

Build a Docker migration command plan

One-liner

curl -fL 'https://www.helper.sh/docker-data-move.sh' -o './docker-data-move.sh'

This command downloads the bundled file only; it does not run it. Inspect the saved source and compare its version before deciding whether to execute it.

Check the file you downloaded

Compare a saved file with the exact bytes bundled in this page’s build. The file stays in this tab; this tool does not upload or persist it. Maximum 2 MiB.

Expected SHA-256
5b35b743ee0609c61f6eca3666a3facb7d35b6e9742a52e5cfcf8ecefdff75e8

Bundled byte count: 12676

Save checksum file

Save the script and checksum in the same directory. On Linux with GNU Coreutils, the command below checks the saved bytes only; it does not run the script. Keep the original filename for this command.

sha256sum --check './docker-data-move.sh.sha256'

No comparison yet.

The checksum and script come from the same site, not an independent signature. A match does not prove safety, authenticity of upstream dependencies, or suitability for your host. Mutable remote dependencies need separate review.

Read validation and limitations

Requirements

  • Linux host
  • Docker installed
  • rsync installed
  • root privileges
  • jq optional for safer JSON edits

Best for

  • Move Docker from a full root or home filesystem onto a larger mount
  • Standardize recovery steps for low-disk Docker hosts
  • Reduce manual mistakes when updating Docker daemon.json

Highlights

  • Detects the current Docker Root Dir automatically
  • Scans local disks and suggests migration targets by free space
  • Backs up the old Docker data directory and daemon config before switching

Recommended procedure

  1. Inspect the current Docker data-root and estimate required free space.
  2. Pick an appropriate target path interactively or via --auto.
  3. Stop Docker services, rsync the data, update daemon.json, and restart Docker.
  4. Verify the new Docker Root Dir and confirm containers are healthy.

Safety notes

  • Review the script before running it on a production host.
  • Prefer interactive mode first when the storage layout is unfamiliar.
  • Confirm backups and target capacity before adding --yes.

Compatibility and limits

  • Linux with Docker, df, du, rsync, service management, and root access; jq is optional.
  • Docker Engine 29+ fresh installs using the containerd image store may keep image contents and snapshots under /var/lib/containerd; this script only moves Docker Root Dir.
  • No dry-run or automatic rollback. Without jq, an existing daemon.json is replaced by a minimal data-root object. Target validation creates the directory and chowns it root:root before checking whether it is empty, so even a refusal can change the target directory owner.

Files, services, and data affected

  • /etc/docker/daemon.json (or CONFIG_FILE): sets data-root; an existing config is backed up, but without jq it is replaced.
  • Stops docker and containerd where services exist, rsyncs Docker Root Dir, renames the old directory to a timestamped .bak path, then starts services.
  • Creates the target directory and sets its owner to root:root before enforcing the empty-target rule; ALLOW_NONEMPTY=1 bypasses that rule.

Read-only verification

  • Confirm `docker info --format '{{.DockerRootDir}}'` equals the selected target.
  • Check `systemctl status docker containerd`, `docker ps -a`, and representative volumes/images.
  • Keep the old .bak directory until application owners confirm service data; the script does not restore it automatically.

If it fails

If target validation refuses the path, inspect the target contents and owner because mkdir/chown runs before the refusal. If a failure occurs after Docker services stop, the script has no cleanup trap and may leave them stopped; inspect both data paths, daemon.json, and `sudo journalctl -u docker -u containerd -n 100 --no-pager`, then plan recovery manually. Preserve backups and do not delete or retry blindly.

Download, inspect, then verify the version before execution. A hash only identifies these exact bytes; it does not prove safety. Piped commands run remote content immediately, and upstream dependencies can change.

Build a Docker migration command plan

Enter paths you have checked yourself. This browser tool does not inspect a host or execute commands. Inputs stay in this tab unless you copy or download a plan; saved plans may contain private paths.

Reviewed scope: a local, rootful Docker Engine on Linux/systemd with the default docker service and /etc/docker/daemon.json. Docker Desktop, rootless Docker, remote Docker contexts and custom service/config paths are outside this builder’s scope. Check the Docker context and environment overrides before maintenance.

Confirm migration scope before entering paths

These are your declarations, not host measurements. Unknown or out-of-scope choices do not generate a run command or JSON plan. Changing a declaration invalidates an existing plan.

How to check without changing configuration

Run these read-only queries only against the intended authorized host/daemon. Keep private endpoints and service settings local. A context name alone does not prove that the daemon is local.

docker context ls
printenv DOCKER_HOST DOCKER_CONTEXT
docker info --format '{{json .SecurityOptions}}'
docker info --format '{{json .DriverStatus}}'
systemctl cat docker

DriverStatus containing io.containerd.snapshotter.v1 indicates the containerd image store: stop here. Docker Engine 29+ fresh installs use it by default; upgraded installations may differ. Do not infer the backend from version or Docker Root Dir alone. If uncertain, keep “not yet confirmed”; do not switch backends just to pass this check.

Docker containerd image store

First read the actual Docker Root Dir on the intended Linux host:

docker info --format '{{.DockerRootDir}}'

Use absolute Linux paths, at most 1,024 characters, without trailing slash, dot segments, repeated slashes, backslashes, or surrounding whitespace. Shell punctuation and spaces are quoted literally.

Only path syntax and the script’s string-prefix guard were checked. Symlinks, actual Docker root, mounts, filesystem features, empty target, ownership, space, permissions, and backups remain unverified. The script detects its own Docker root at runtime; the current-root field here does not override it.

Source and limitations: View the bundled script · Docker data-directory documentation

Read scope checks and verification limits

Check a local migration log excerpt

Related topics

CentOS 7: choose a recovery task

Separate repository failures, SSH access problems and Docker storage pressure before changing an end-of-life host.

Open topic