Move an Existing Docker Container to a New Computer

You can move an existing Docker container to a new computer, but the reliable approach is to move its configuration, images, and persistent data, not just the container entry itself. For most development setups, save the Docker Compose project, copy bind-mounted or volume data, transfer needed images, and recreate the containers on the new machine. A full Docker Desktop disk backup is useful when you need to preserve an entire Docker Desktop environment.

What Actually Moves With a Docker Container

A container is not a portable virtual machine. It is a running or stopped instance of an image plus configuration such as environment variables, port mappings, networks, mounts, and a writable filesystem layer.

The important distinction is where your data lives:

  • Image: The application base, dependencies, and layers used to create a container.
  • Container writable layer: Changes made inside a running container that are not in a mounted volume.
  • Named volume: Docker-managed persistent storage, often used for databases.
  • Bind mount: A directory on the old computer that Docker exposes inside the container.
  • Compose project: The configuration that defines services, networks, ports, environment variables, and mounts.

A container migration is complete only when the new machine has the configuration, image, and persistent data needed to recreate and run the service.

For a container started with Docker Compose, the Compose file is usually the most important configuration artifact. Keep the Docker Compose file from the project directory used to start the old containers, along with related .env files, Dockerfiles, application configuration, and secret-management files where appropriate.

How to Move Docker Containers to a New Computer

Choose the method that matches what you need to preserve before copying anything.

Your situation Best approach What to transfer
You have a Compose-based app and want a portable setup Recreate containers on the new computer Compose project, bind-mounted folders, named-volume backup, image archive if needed
You need the entire Docker Desktop environment intact Back up Docker Desktop’s VM disk Docker Desktop data disk plus external bind-mounted folders and project files
You only need logs or selected files from a container Copy files out before moving Selected files and the configuration needed to use them
You need a filesystem snapshot but not a runnable copy Export the container filesystem Export archive plus separate configuration and volume backup

Step 1: Inventory Containers, Images, and Storage on the Old Computer

Start by listing every container, including stopped containers. The standard listing only shows running containers, so use:

docker ps -a

Write down the container names, image names, exposed ports, and status. Then inspect each container you plan to migrate:

docker inspect CONTAINER

Replace CONTAINER with the actual container name or ID. The inspection output shows mounted paths, port mappings, environment variables, networks, restart policies, and other details needed if you must recreate a standalone container manually.

List locally stored images:

docker image ls

List named volumes:

docker volume ls

Check the Mounts section of the inspection output carefully:

  • A mount with "Type": "bind" points to a folder on the old computer. That folder must be copied separately.
  • A mount with "Type": "volume" is a named Docker volume. Back it up separately unless you are moving the whole Docker Desktop disk.
  • A mount with "Type": "tmpfs" is temporary memory-backed storage and normally should not be migrated.

I prefer rebuilding from a Compose file here because it makes ports, host paths, environment settings, and service dependencies explicit instead of leaving them buried in container metadata.

Step 2: Stop Stateful Services Before Copying Their Data

Stop containers that write important data before making a filesystem-level backup. This prevents files from changing halfway through a copy.

docker stop CONTAINER

For a multi-container application, stop the database first only if its application documentation requires that order; otherwise, stop the application services that write to it, then stop the database cleanly.

For databases, an application-native backup or dump is usually safer than copying a live database directory. Create that application-level backup before stopping the database when its documentation supports it, then also preserve the volume or bind-mounted files if you need a full local recovery copy.

Do not remove the old containers until the new machine is running correctly. The old computer is your fallback.

Step 3: Copy the Compose Project and Persistent Data

Copy the whole project directory that contains your Docker Compose file to the new computer or to transfer storage. Include the Compose file, application source, configuration files, .env files, Dockerfiles, scripts, and any local directories mounted into containers.

A bind mount connects a host directory to a container directory. A recreated container may use mount syntax like this:

docker run --mount type=bind,source=/HOST/PATH,target=/CONTAINER/PATH,readonly nginx

Replace /HOST/PATH with the directory on the new computer and /CONTAINER/PATH with the path expected inside the container. The readonly option is appropriate only when the old mount was read-only. Docker recommends the --mount syntax because it fails clearly if the source path does not exist.

Copy every bind-mounted source directory from the old computer. These files are outside Docker’s image and container storage, so saving an image or container alone does not include them.

For a named volume, create an archive on the old computer. The following example backs up a volume named mydata into the current directory on macOS or Linux:

docker run --rm --mount source=mydata,target=/data,readonly --mount type=bind,source="$PWD",target=/backup alpine tar -czf /backup/mydata.tar.gz -C /data .

Transfer mydata.tar.gz to the new computer with the project files. After Docker is installed on the new computer, create the named volume:

docker volume create mydata

Then restore the archive into it:

docker run --rm --mount source=mydata,target=/data --mount type=bind,source="$PWD",target=/backup alpine sh -c "tar -xzf /backup/mydata.tar.gz -C /data"

Use the actual volume name from the old computer in place of mydata. If the application uses multiple named volumes, back up and restore each one separately.

Step 4: Save Images and Capture Container Filesystem Changes

If the images are public and available for the target architecture, the new computer can often pull them again. Save images when you need to work offline, use locally built images, or want an exact copy of image layers.

Docker’s image-save syntax is:

docker image save -o images.tar image1 [image2 ...]

Replace image1 [image2 ...] with the image names shown by the image listing. For example:

docker image save -o images.tar myapp:latest postgres:16

Transfer images.tar to the new computer.

If you made important changes directly inside a container rather than through a Dockerfile or bind mount, commit the container to a new image before saving it:

docker container commit CONTAINER migrated-container:backup

Then save that committed image:

docker image save -o images.tar migrated-container:backup

A committed container image can retain filesystem changes and some configuration, including labels and environment variables. Treat it as sensitive: environment variables may include passwords, tokens, or proxy credentials. Committing or saving a container does not include data stored in mounted volumes.

Step 5: Transfer, Load, Recreate, and Test on the New Computer

Install Docker Engine or Docker Desktop on the new computer first. Transfer these items:

  • The Docker Compose project directory
  • Bind-mounted host directories
  • Named-volume archive files
  • images.tar, if you saved images
  • A copy of the container inspection output if the setup was not defined in Compose

Load the transferred image archive:

docker image load -i images.tar

Restore each named volume using the volume-creation and archive-extraction commands from the backup process. Put bind-mounted folders at the paths expected by your Compose file, or update the host-side paths in the Compose configuration.

From the project directory, recreate and start Compose services:

docker compose up -d

For a container that was not created with Compose, use the saved inspection output to recreate its image, ports, environment variables, networks, restart policy, and mounts. Do not assume that a committed image restores those runtime settings automatically.

Use a Full Docker Desktop Backup When You Need the Whole Environment

Docker Desktop’s backup-and-restore process can preserve images and container data when you are moving to a new computer or recovering from a failed installation. This is useful when rebuilding each container would be impractical.

Fully quit Docker Desktop before copying its VM disk. Do not copy the disk while Docker Desktop is running.

On macOS, the default Docker Desktop data disk is:

~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw

On Docker Desktop for Linux, the default location is:

~/.docker/desktop/vms/0/data/Docker.raw

If you changed the disk location, use the configured location shown in Docker Desktop under Settings > Resources > Advanced. Copy the applicable Docker.raw file to safe storage, along with Compose projects and host directories used as bind mounts.

On Windows, Docker Desktop storage differs depending on whether it uses the WSL 2 backend or the Virtual Machine Manager backend. Check Settings > General to identify the backend, preserve the corresponding virtual-disk data, and re-import WSL distributions if the setup requires it.

On the new computer:

  1. Install Docker Desktop.
  2. Fully stop it before replacing its newly created data disk.
  3. Restore the backed-up disk to the same configured location.
  4. Start Docker Desktop and verify the expected images, containers, and volumes appear.
  5. Copy external bind-mounted folders and Compose project files separately, because those host directories may not live inside Docker Desktop’s disk.

Docker’s backup and restore guidance documents this approach and the current default locations.

Copy Selected Files or Export a Filesystem When You Do Not Need a Full Migration

Sometimes you need only logs, generated files, or a configuration file from a container. Docker can copy files from a running or stopped container to the old host.

The general syntax is:

docker container cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-

For example, to copy a container’s logs to an existing local temporary directory:

docker cp CONTAINER:/var/logs/ /tmp/app_logs

Replace CONTAINER with the container name and /var/logs/ with the source path. Ensure the local destination’s parent directory exists; the copy command does not create missing parent directories. Use this for selected unmounted files, not as a replacement for backing up bind mounts or named volumes.

A filesystem export is a different tool. Its syntax is:

docker container export [OPTIONS] CONTAINER

For example:

docker container export --output container-rootfs.tar CONTAINER

You can turn the exported filesystem into a new image on the new computer:

docker import container-rootfs.tar restored-container:latest

This is a filesystem-only fallback, not a full container migration. Docker export does not include associated volumes. If a volume is mounted over a directory in the container, the export contains the underlying directory from the image rather than the mounted volume’s contents. It also does not preserve the container’s port mappings, networks, environment configuration, or Compose definition. Docker’s container export reference covers that limitation.

Check Architecture and Application Compatibility

Moving from an Intel or AMD computer to an ARM-based computer is not only a file-transfer problem. Images may target architectures such as amd64 or arm64.

Check the new computer’s architecture and confirm that each needed image supports it. Multi-platform images normally pull the correct variant automatically, but an old locally built image archive may contain only one architecture.

If an image does not support the new architecture, rebuild it from its Dockerfile on the new computer or use an image tag that supports the target platform. For databases and other stateful services, also keep the application version compatible with the copied data before starting the restored service.

Confirm the Migration Before Wiping the Old Computer

Run through this short verification list on the new computer:

  • Confirm all expected containers appear and are running.
  • Open the application through its expected port or URL.
  • Check that expected database records, uploaded files, and generated content are present.
  • Confirm bind-mounted directories point to the intended new-computer paths.
  • Confirm named-volume data is readable by the application.
  • Review container logs for missing environment variables, permissions errors, or connection failures.
  • Restart the application stack and confirm it comes back cleanly.
  • Keep the old computer or a read-only backup until the new setup has been used successfully.

A successful start is not enough if persistent data is missing. Test the feature that depends on the data, such as loading an existing record, opening an uploaded file, or connecting one service to another.

Frequently Asked Questions

Can I Move a Docker Container to Another Computer?

Yes, but move the container’s configuration and persistent data along with its image. The most portable approach is to transfer the Docker Compose project, bind-mounted host folders, named-volume archives, and any locally built image archive. Recreate the containers on the new computer and test the application before deleting the old environment.

How Do I Move a Docker Image to Another Machine?

Save the image on the old computer, transfer the archive, then load it on the new computer.

docker image save -o images.tar image1 [image2 ...]
docker image load -i images.tar

Replace image1 [image2 ...] with the actual image names and tags. This transfers image layers, but it does not transfer bind-mounted folders or named-volume data.

Will Docker Export Move My Volumes Too?

No. A container filesystem export excludes associated volumes, and it can export an underlying image directory instead of the data in a volume mounted over that location. Use a named-volume archive, an application-native database backup, or a full Docker Desktop data-disk backup when volume data matters.

Can I Copy Docker Desktop Files Directly to a New Laptop?

Yes, if you use Docker Desktop’s whole-environment backup process and fully stop Docker Desktop first. The default macOS data disk is ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw, while Docker Desktop for Linux commonly uses ~/.docker/desktop/vms/0/data/Docker.raw. Copy external bind-mounted directories separately because they may exist outside that Docker Desktop disk.

Will a Docker Backup Work on an Intel Computer and an ARM Computer?

Not always. Images may be built for amd64 or arm64, so confirm the image supports the new computer’s architecture before relying on an archive or full environment copy. Once the containers run, data is present, and the application works normally on the new hardware, keep one untouched backup of the old setup before you erase or repurpose the old computer.