avatarBhargav Bachina

Summary

The website provides instructions on how to share Docker images without using Docker Hub or any private registry by using the save and load commands to manage images as tar files.

Abstract

The article titled "How to share docker images without Docker hub or any registry" outlines a method for distributing Docker images in situations where using a registry is not feasible. It introduces the save and load commands as key tools for this process. The save command allows users to export a Docker image to a tar file, which can then be shared or archived. Conversely, the load command is used to import a Docker image from a tar file into a local Docker environment. The article demonstrates the use of these commands with a practical example involving the busybox image. Additionally, it extends the concept to customized images by showing how to save and load a user-built Docker image from a GitHub repository. This approach is presented as a versatile solution for users who need to share images without relying on online registries.

Opinions

  • The article suggests that using the save and load commands is a convenient and flexible way to manage Docker images without depending on registries.
  • It implies that there are scenarios where reliance on Docker Hub or private registries is not possible or desired, necessitating alternative image sharing methods.
  • The author seems to consider the save and load method to be user-friendly and straightforward, as evidenced by the inclusion of step-by-step instructions and code examples.
  • The article acknowledges the utility of being able to save images in tar files for purposes beyond sharing, such as archiving or using them as base layers for other images.
  • By providing a real-world example with a customized image, the author conveys the practicality and effectiveness of the outlined method for sharing Docker images.

How to share docker images without Docker hub or any registry

Photo by Elaine Casap on Unsplash

There are some instances where you can’t publish your image to docker hub or any private registry. This story gives you options on how to share your images without publishing to docker hub or any private registry. save and load are the two commands which we can use for this purpose

Docker Hub Images

Let’s pull the busybox from the docker hub.

mkdir saveimage
cd saveimage
docker pull busybox

docker has save command where you can save into tar file. We can list the directory after save.

docker save busybox > busybox.tar

Let’s list all the images and remove the busybox image from the local docker registry.

Load the image from the tar file. once you load the image you can interact with it and run the container as an official image.

docker load < busybox.tar

Customized Images

we can do the same thing with user-customized images as well. Let’s clone this repo and see how it works.

git clone https://github.com/bbachi/dockerfiles-cmdvsentry.git

Build the docker image with this command

docker build -t nodeversion -f echo/Dockerfile.cmd .

Use save command to save the image to the tar file.

// save to tar file
docker save nodeversion > nodeversion.tar
// load from tar file
docker load < nodeversion.tar

Conclusion

This is a great way to share the images without any registry. Sometimes you want to save images in the tar file and use it in other images.

Docker
Dockerfiles
Docker Im
Docker Training
Docker Tutorial
Recommended from ReadMedium