“docker save” Command Examples

The command “docker save” is a Docker CLI command that allows you to export one or more Docker images into an archive file. It essentially creates a compressed file that contains all the necessary components of the Docker image, including the layers, metadata, and configuration information.

When you use the “docker save” command, you specify the image or images you want to export, and Docker creates a tarball file (.tar) that encapsulates the selected image(s) and their dependencies. This file can then be transferred to another system or stored for later use.

Once you execute the command, Docker creates a tarball file that includes all the necessary files and information required to recreate the exported image(s). This file can be transferred to another system using various methods such as copying it over a network or using a file transfer protocol.

To import the exported Docker image(s) back into Docker on another system, you can use the “docker load” command, which allows you to load images from a tarball file.

The “docker save” command is useful in scenarios where you need to share or distribute Docker images with others or move them between different environments. It provides a convenient way to package and transport Docker images as a single archive file, making it easier to manage and deploy containers across different systems.

docker save Command Examples

1. Save an image by redirecting stdout to a tar archive:

# docker save image:tag > /path/to/file.tar

2. Save an image to a tar archive:

# docker save --output /path/to/file.tar image:tag

3. Save all tags of the image:

# docker save --output /path/to/file.tar image_name

4. Cherry-pick particular tags of an image to save:

# docker save --output path/to/file.tar image_name:tag1 image_name:tag2 ...
Related Post