Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk10 min

How to Back Up and Restore Docker Containers and Volumes

A complete, practical procedure for backing up Docker volumes, images, and configuration—and restoring services safely on the same host, a new server, or a reinstalled Docker Desktop.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Back up Docker in separate layers: archive every named or anonymous volume that contains application data, save any locally built or cached images, and retain the Compose file or the original docker run options. A container archive alone is not enough. docker export omits mounted-volume contents, and docker container commit also excludes changes made in attached volumes.

The most portable procedure uses a temporary helper container, --volumes-from, a host-mounted backup directory, and tar. On recovery, create a new destination volume, extract the archive into it, load required images, and recreate containers from declared configuration. The same sequence works for moving services to another host and for rebuilding Docker after a Desktop reinstall.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What a complete Docker backup contains

Docker separates a container’s writable layer, its images, its runtime configuration, and its persistent data. Treat those as different recovery artifacts rather than expecting one command to capture everything.

Persistent data: volumes and bind mounts

A Docker volume is managed separately from the lifecycle of the container that uses it. Removing a container does not, by itself, remove the data stored in its volume. Databases, uploads, queues, and application state therefore need their own archives. Back up each named or anonymous volume individually.

#1 Best Overall
SSK Portable SSD 1TB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 1TB external ssd often appears as around 931GB on Windows. MacOS can show full 1 TB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
  • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
  • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
  • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity

If a service uses a bind mount, the data resides in a directory on the Docker host rather than in a managed volume. Preserve that host directory and record the mount source and target along with the container configuration. A container or image archive does not recreate the host files in a bind mount.

Images

Save locally built images and any cached images that you must be able to run offline or that may no longer be available from a registry. docker image save stores the selected image layers and tags in a tar archive; it does not include runtime volume data.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configuration

Keep the Compose file, environment-file requirements, secrets-handling procedure, port mappings, networks, mount declarations, image tags, and the options used with each docker run. Configuration is what lets you recreate an equivalent container after loading the data and images.

Before archiving: make an inventory and quiesce writers

  1. List every service and container. Record container names, the exact image and tag, environment variables, published ports, attached networks, volume names, bind-mount paths, and any secrets or credentials supplied at runtime.
  2. Keep the declarative source. Store the Compose file or a written record of the original docker run commands in the same recovery set. Docker Desktop guidance notes that retaining creation options is essential when containers must be recreated after reinstallation.
  3. Identify authoritative data. Mark which volume or host directory contains the application’s durable state. Do not assume that a container’s writable layer is the source of truth.
  4. Stop or pause writers when consistency matters. A database or other stateful service should be quiesced according to its own backup requirements before you read its files. Docker supplies the archive mechanics; the application owner must decide how to obtain a transactionally consistent state.

Stopping a service prevents new writes while the archive is being created. If downtime is unacceptable, use the application’s supported online-backup process first, then archive the resulting files.

Back up a Docker volume with the documented tar pattern

The following example archives a volume mounted at /dbdata. Run it from a directory on the host where the archive should be written.

  1. Create a helper container with the source volume attached:
    docker run -v /dbdata --name dbstore ubuntu /bin/bash

    This creates a stopped helper container whose /dbdata mount is the volume to be copied. Use the volume and mount path that match your service.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    Rank #2
    SSK Portable SSD 250GB External Solid State Hard Drive USB C Up to 1050MB/s
    • Capacity Display Variance: 250GB external ssd often appears as around 232GB on Windows. MacOS can show full 250 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
    • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
    • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
    • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
    • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity
  2. Mount the host backup directory and create the tar archive:
    docker run --rm --volumes-from dbstore -v $(pwd):/backup ubuntu 
      tar cvf /backup/backup.tar /dbdata

    --volumes-from dbstore exposes the source volume inside the temporary process. The host working directory is mounted as /backup, so the resulting file is written outside Docker. When the command completes, backup.tar contains the volume contents.

  3. Repeat for every data volume. Use a distinct archive name for each volume, such as database.tar, uploads.tar, or cache.tar. Keep a mapping between each archive and the volume name or mount target recorded in your inventory.
  4. Remove the helper when it is no longer needed:
    docker rm dbstore

    Removing this helper does not delete the separately managed volume. Do not remove a production container or volume merely to perform the backup.

The archive command preserves the directory tree as seen inside the volume. If you use a different mount point, substitute that path consistently in both commands.

Restore a volume into a new container or host

Restore into a newly created destination volume whenever possible. This avoids mixing old files with files left by a previous failed attempt.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Create a destination helper and attach the new volume:
    docker run -v /dbdata --name dbstore2 ubuntu /bin/bash

    On a new host, this creates the destination volume at the same in-container path used by the archive example.

  2. Extract the archive into the destination:
    docker run --rm --volumes-from dbstore2 -v $(pwd):/backup ubuntu 
      bash -c "cd /dbdata && tar xvf /backup/backup.tar --strip 1"

    The cd /dbdata target is the mounted destination. The archive has a top-level dbdata directory, so --strip 1 removes that first path component and places the files directly in the volume root.

    Rank #3
    SSK Portable SSD 500GB External Solid State Hard Drive USB C Up to 1050MB/s
    • Capacity Display Variance: 500GB external ssd often appears as around 465GB on Windows. MacOS can show full 500 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
    • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
    • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
    • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
    • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity
  3. Recreate the real service. Use the Compose file or the original docker run options, attaching the restored volume at the path expected by the application.
  4. Verify application data before accepting traffic. Check that the service starts, can read its database or files, and shows expected records, users, uploads, and configuration. A successful extraction only proves that files were written; it does not prove that the application can use them.

Docker documents this pattern as suitable for automation and restore testing. Perform the extraction on a disposable volume first if the data is critical.

Preserve and reload images

Volume archives hold data, not executable image layers. Save images separately when you need to rebuild without pulling from a registry or when an image was built locally.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Save selected images

docker image save -o images.tar image1 image2

The saved tar includes the parent layers and tags for the images you specify. Include every image referenced by the Compose file or by your recorded docker run commands.

Compression is optional and reduces storage use at the cost of compression and decompression time:

docker image save myimage:latest | gzip > myimage_latest.tar.gz

Load images on the recovery host

docker image load -i images.tar

For a gzip-compressed archive, decompress it first or pipe it through the appropriate decompressor. Confirm that the expected repository names and tags are present before recreating containers; a configuration that references a tag not loaded locally will fail until that image is available.

Recreate containers from declared configuration

Containers are disposable runtime objects. Rebuild them from the Compose file or by repeating the original options rather than treating a container filesystem export as a complete backup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Crucial X9 2TB Portable SSD, Up to 1050MB/s, USB 3.2 USB-C, External Solid State Drive, Compatible with Windows, Mac, & Android, Reliable Storage for Games, Files, & Backups, Black - CT2000X9SSD902
  • High-speed Performance: Designed for casual gamers and everyday use, this external SSD with up to 1050MB/s accelerates large file transfers, media editing, and backup processes outperforming traditional hard drives
  • Built to Last: Perfect for travel and all types of weather with IP55 water and dust resistance. Plus, it's drop resistant up to 7.5 ft (2 meters). This portable drive is designed for durability and reliability wherever you go
  • Broad Compatibility: External drive connects effortlessly with Windows, Mac, iPad Pro, Chromebooks, Android, Linux, PS4, PS5, and Xbox via USB-C and USB-A for easy and fast file transfers
  • High-Capacity Storage: Store all your photos, videos, backups, and more with this compact 2TB SSD. It's perfect for students, everyday users, and anyone needing secure and reliable storage for their files
  • Bonus Software Included: Enjoy three months of Mylio Photos plus and Acronis True Image when you purchase and register your external drive

Preserve, at minimum:

  • Image names and exact tags.
  • Environment variables and the mechanism used to provide secrets.
  • Published ports and exposed service-to-service ports.
  • Network names and aliases.
  • Volume names, bind-mount source paths, and container mount paths.
  • Restart policies and other runtime options required by the application.

When data is in volumes or bind mounts, Docker Desktop guidance says backing up the containers themselves may not be necessary if these creation options are retained. The volumes and host directories still require independent backups.

Moving Docker volumes to another server

  1. On the source host, stop or quiesce stateful services and create one tar archive per volume.
  2. Copy the volume archives, image archive, Compose/configuration files, and any required environment or secret material to the destination through your approved transfer method.
  3. Install a compatible Docker environment on the destination and load the image archive with docker image load.
  4. Create a new destination volume for each archive and extract it with the helper-container procedure.
  5. Adjust host-specific bind-mount paths, network details, and secret delivery only where the destination requires it; keep container mount paths consistent with the application.
  6. Start the services from the Compose file or recorded run commands, then perform an application-level verification before switching clients or DNS.

Volume archives are portable data artifacts, while Compose files and image archives provide the context needed to run that data. Neither one replaces the other.

Restoring after Docker Desktop is reinstalled

A Desktop reinstall can remove or replace the local Docker VM or its disk image, depending on the operating system and recovery path. A VM-level backup may help with platform-specific recovery, but its storage location and format are backend- and OS-specific and are less portable than volume and image archives.

For a portable rebuild, use this order:

  1. Install Docker Desktop and confirm the engine is running.
  2. Copy the separately stored archives and configuration files onto the new system.
  3. Load required images with docker image load -i images.tar.
  4. Create fresh volumes and extract each corresponding archive.
  5. Recreate containers from Compose or the saved run options, including bind mounts and environment settings.
  6. Run the services and verify their data before deleting the recovery copies.

Keep the backup set on storage separate from the Docker host. An external USB SSD or hard drive is a practical destination, provided its capacity, interface, and operating-system compatibility meet your needs. Maintain enough copies that a failed host does not also destroy the only archive.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why docker export and docker commit are incomplete backups

docker export

docker export archives a container’s filesystem, including changes in its writable layer. It does not export the contents of volumes associated with that container. The command also exports the underlying directory beneath a mounted volume rather than the mounted volume’s data. Use it only when that writable-layer snapshot is specifically what you need, not as a substitute for a volume archive.

docker container commit

docker container commit creates a new image from filesystem changes in a container and can capture selected configuration. Changes made in attached volumes are not included. A committed image may also contain environment variables with passwords, proxy credentials, or other sensitive values, so treat it as confidential and inspect its contents and access controls before storing or sharing it.

Best Value
OSCOO 2TB External Hard Drive, Up to 2100MB/s, USB 3.2 Gen 2 External SSD
  • Built for Creators: Capture, edit, and transfer with ease. NVMe SSD with premium NAND Flash delivers up to 2100MB/s—perfect for 5K video, RAW photos, and gaming assets
  • Record Without Limits: Direct 4K 120fps HDR recording from compatible USB-C iOS/Android phones, cameras, and tablets with supported pro apps. Ideal for high-bitrate shooting on the go
  • Rugged, Reliable, Ready: Durable aluminum shell with water- and drop-proof protection. SMART monitoring and advanced error correction keep your data safe in any environment
  • Works Where You Do: True plug-and-play with laptops, desktops, cameras, projectors, and more. Fully compatible with Windows, Mac, iPad Pro, Chromebooks, Android, Linux, PS4, PS5, and Xbox devices
  • Pocket-Sized Power & Capacity Notice: Ultra-slim 2.85 × 1.52 × 0.40 in, 0.03 lb SSD fits any pocket or gear bag. Actual usable storage may be ~7–10% less than labeled due to system calculation differences. Supports up to 2100MB/s under ideal USB 3.2 Gen 2x2/Thunderbolt 4/5 conditions; older interfaces may reduce speeds

Choosing the right recovery artifact

Approach Captures Does not solve Best use
Volume tar archive Persistent files in a named or anonymous volume Container configuration and image layers Database and user-data backup or migration
docker image save/load Selected image layers, parent layers, and tags Runtime volume data Offline image preservation
docker export Container writable filesystem Mounted-volume contents and runtime configuration One-off filesystem capture
docker commit Container filesystem changes and selected configuration Attached-volume changes; may expose secrets Emergency snapshot of mutable container state
Compose or recorded run options Service definitions, mounts, networks, and runtime options Data and image bytes Repeatable container recreation
Docker Desktop VM backup Platform-specific Desktop VM disk or image data Portability across backends and operating systems Desktop VM or reinstall recovery when supported

Storage, integrity, and restore testing

Keep volume archives, image archives, Compose/configuration files, and integrity metadata outside the Docker host. Record which archive belongs to which volume, when it was created, and whether application writers were stopped. Protect archives containing personal data, credentials, or database files with the same access controls as the live system.

A backup is credible only after a restore has worked. Periodically test on a fresh volume and disposable container: load the images, recreate the services, extract every volume archive, and exercise the application’s important read and write paths. Test the exact recovery sequence you would use after host loss or a Desktop reinstall, not merely the command that created the archive.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting common failures

The restored container starts but shows an empty database

Check that the restored volume is mounted at the application’s expected container path and that the service was recreated with the same volume mapping. Inspect the archive mapping in your inventory; extracting a database archive into a different mount path does not make the application use it.

The archive command succeeds but recent records are missing

The application was likely still writing while files were read. Repeat the backup with the database or stateful service stopped or paused according to its consistency procedure, then restore into a new volume and validate the expected records.

The rebuilt service cannot find its image

Load the image archive and verify that the repository name and tag match the configuration. Saving an image under one tag does not automatically satisfy a Compose file that requests a different tag.

A migrated service cannot access a host directory

Bind mounts refer to paths on the host, not to portable Docker volumes. Recreate the source directory on the destination, copy its data separately, and update the host-specific path while preserving the container-side mount path expected by the application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A committed image contains confidential values

Assume environment variables and filesystem changes captured by a commit are sensitive. Restrict access, rotate exposed credentials, and prefer rebuilding from a clean image and externalized secret configuration for normal recovery.

Recovery checklist

  • Inventory containers, images, tags, ports, networks, mounts, environment variables, and secret requirements.
  • Retain the Compose file or complete docker run options.
  • Quiesce databases and other stateful writers when application-level consistency requires it.
  • Create a separate tar archive for every data volume.
  • Save locally required images with docker image save.
  • Store archives and configuration on media separate from the Docker host.
  • On recovery, load images, create fresh volumes, extract archives, and recreate containers.
  • Verify application data and periodically perform a complete restore drill.

This layered method preserves what Docker actually separates: data in volumes, executable layers in images, and runtime behavior in configuration.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.