If you’re like most sysadmins, you probably move your servers around a lot. You might upgrade one server and move all of your applications and data to it. Or you might decommission one server and move all of your applications and data to another. Whatever the reason, you probably end up with a bunch of Docker images on each server. You might have created them when you first set up the server, or you might have pulled them down from a public repository. Now what? There are a few different ways to package and transfer Docker images from one server to another. The most common way is to use the docker-compose tool. docker-compose can take a bunch of images and create a single image that contains everything needed to run the applications that are in the images. This makes it easy to transfer an image from one server to another. Another way is to use the docker-pull command. This command takes an image name or URL and downloads it into your current working directory. Then you can use it just like any other image in your project. ..


If you’ve built a Docker image on your development machine, and want to deploy it on a server, you could use a Docker registry, but Docker also has tools for saving images to files, and loading them on a different server.

You Don’t Need A Container Registry

Usually, to transfer a build of a container (called an image) to a remote server, you use a Docker container registry. This is by far the best method—it’s a single point of authority, making it easy to distribute updates across multiple servers. This doesn’t require you to make the container public either; there are plenty of great private container registries, such as Google’s GCR and AWS’s ECS. The Docker Hub even support private repositories. If you’re simply concerned about privacy, switch to a private registry and continue using docker push and docker pull.

However, for those looking to do it the old fashioned way, the Docker CLI contains some tools for saving images to files, and loading them on a remote server.

To save an image, you can use docker save, specifying an output file, and then specify an image name and tag:

If you don’t specify a tag, Docker will package all tags.

This will serialize and save a copy of the image under the output file. The image is stored as a tarfile. If you’d like to save it as a tar.gz, you can omit the -o flag and pipe the output to gzip:

You can then take this file and scp or FTP copy to the target server. Once it’s there, you can use docker load to import it again:

This will make the image available on the target system as if you had ran docker build . -t imagename. You can use it just like a locally built image with docker container run: