Passing docker images without registry

Passing docker images without registry

I always wished for a way to quickly transfer a docker image from one machine to other machine, without the hassle of registry setup and access control.

Until today, I was always sending (copy-paste) Dockerfile and building the image in destination machine again. Given the predictability, it works wonderful.

But, that's exactly what Docker is supposed to solve.

Build once, run everywhere.

I've only recently learned, there's a straight forward way to compress docker image into a more filesystem friendly formats like zip or tar and it's fairly well documented.

Docker save and load

Docker has a command called docker save which allows exactly what I want.

  • docker save image_name:latest | gzip > image_name_latest.tar.gz and scp/upload to s3 and download the tar file to destination machine.

  • unzip the file on destination, run docker load < image_name_latest.tar.gz and voila, docker images ls shows my image.

Docs here: https://docs.docker.com/engine/reference/commandline/save/