As an alternative to managing Docker images using a Docker Registry, you can also manage it as a tar file.
Managing Docker images as tar files allows you to:
- Save docker images as a file
- Load images from a file
- Share images without a registry: Share the tar file instead of pushing to a registry
- Backup images: Regularly save images to tar files for safekeeping
- Migrate images: Move images between systems by loading the tar file
Docker Commands:
Save an image to a tar file:
docker save -o image.tar image_name
Save an image to a tar file using pigz compression:
docker save my_image | pigz > my_image.tar.gz
pigz is a parallel implementation of gzip that can significantly speed up compression. |
Load an image from a tar file:
docker load -i image.tar
Load an image from a tar file using pigz decompression:
pigz -dc my_image.tar.gz | docker load
Import a tar file as a new image:
docker import image.tar new_image_name
Import an image from a tar file using pigz decompression:
pigz -dc image_name.tar.gz | docker import - image_name