Wednesday, November 22, 2017

Oracle Linux - import / load a docker image

When running Docker on Oracle Linux (or any other distro) you can pull images from a registry. The pull command will contact the registry and download the needed. You can use a public registry such as or you can have a private registry within your secured environment. This mechanism works fine and you should always strive to have the option to use a registry, being it private or public. However, in some cases you do not have the luxury of having a registry and you will have to import / load an image directly into Docker to be able to start a container based upon the image.

When you want to export an image and import it on another Docker node the following commands should be used.

To save an image use the following command:
docker save -o {save image to path} {image name}

To load an image use the following command:
docker load -i {path to image tar file}

It is important to understand you need to use the save and load commands and not the export and import commands as they do very different things:

export - Export a container's filesystem as a tar archive
import - Import the contents from a tarball to create a filesystem image
save - Save one or more images to a tar archive (streamed to STDOUT by default)
load - Load an image from a tar archive or STDIN

No comments: