Docker import is a command used to create an image from a local file or directory. It can be used to package and distribute applications or system configurations as Docker images. The syntax for the command is:
docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
Options:
--change
: Apply Dockerfile instruction (ex.--change="CMD /bin/echo hello"
)
Arguments:
file|URL|-
: Specifies the file, URL, or-
to use STDIN as input.[REPOSITORY[:TAG]]
: Specifies the name and optional tag of the imported image.
Example usage:
$ docker import myapp.tar.gz myimage:1.0
This will create an image called “myimage” with the tag “1.0” from the “myapp.tar.gz” file.