Importing an image
To get a local copy of the image, we either need to pull it from the accessible registry or import it from the already exported image, as we saw in an earlier recipe. The docker image import command lets you import one or more images from a tarball. The docker image import command syntax is as follows:
docker image import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]Getting ready
Before you begin, you need a local copy of the exported Docker image.
How to do it...
Perform the following steps:
- Transfer the
myapache2.tarfile we created in the previous recipe to a new Docker host using any of your favorite file transfer tools. - Now, on the new Docker host, import the transferred
myapache2.tarfile, as shown in the following code:
$ docker image import myapache2.tar apache2:imported- Here, we have imported our
myapache2.tarfile as anapache2:importedimage.
There's more...
You can also import TAR files stored in a remote location by specifying their URL.
See also
- The
helpoption of...