docker import

Command Name: 

docker import

Description:

Import the contents from a tarball to create a filesystem image. What does this mean is we create the image and save it as an archive in tarball for any other purpose or use as a deployable file.

Steps: 

  1. Save docker image as tar
  2. Import this tar as image

Syntax:

easywhatis$ docker import --help

Usage: docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]

Import the contents from a tarball to create a filesystem image

Options:
  -c, --change list      Apply Dockerfile instruction to the created image
  -m, --message string   Set commit message for imported image
easywhatis$

Example:

easywhatis$ docker save busybox > busybox.tar
easywhatis$ ls
Dockerfile busybox.tar
easywhatis$ rm busybox.tar
easywhatis$ ls
Dockerfile
easywhatis$ docker image save busybox >busybox.tar
easywhatis$ docker image import busybox.tar busybox:1
sha256:5fd493f7edba75aaf2a5c755198af41eaae49c32935d6a56268b48dd1f2e6edc
easywhatis$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
busybox             1                   5fd493f7edba        3 seconds ago       1.44MB