pwa.io

Using Docker without a registry

Discover the secret to transferring Docker images between machines without the need for a registry!

Recently I build a little something and wanted to deploy it via Docker. It was getting late, and I didn't feel like setting up a Docker registry with authentication and stuff. However, I was curious if it's possible to move a Docker image from one machine to another without a registry. And guess what, it is possible.

To accomplish this, you just need to use the docker save and docker load commands.

# After building your image, use docker save to save it to a tar file
docker save your-image:latest > saved-image.tar

# On the destination server, use docker load to load the image from the tar file
docker load < saved-image.tar

This is a simple way to move docker images from one machine to another, but it has some drawbacks. First of all, it is quite slow, because you always have to transfer the whole image. I guess you could use gzip to compress the tarball before transferring it, but pushing and pulling from the registry is much faster, because it only transfers the layers of the Docker image that have changed.

So, should you spend hours waiting for file uploads using this method, or should you just start the registry Docker image and quickly add some .htaccess Basic auth, which should not take more than five minutes? I guess the latter is the better choice.

Or you just use the build-in registry of your Gitea instance, but that would have been too easy.