Exporting an image
Let's say you have a customer who has very strict policies that do not allow them to use images from the public domain. In such cases, you can share one or more images through tarballs, which can then later be imported on another system.
The docker image save
command lets you save or export images as tarballs. The command syntax is as follows:
docker image save [-o|--output]=file.tar IMAGE [IMAGE...]
In this recipe, we will learn how to export an image using the docker image save
command.
Getting ready
Before you begin, first pull or import one or more Docker images on the Docker host.
How to do it...
Let's pick the myapache2
image we created in the Create an image from a container recipe and export the image as a .tar
file, as shown in the following code:
$ docker image save --output=myapache2.tar myapache2
The preceding command generates the myapache2.tar
file, which can be imported as described in the next recipe.
There's more...
You can also export the container's filesystem...