github.com/justincormack/cli@v0.0.0-20201215022714-831ebeae9675/man/src/image/import.md (about)

     1  Create a new filesystem image from the contents of a tarball (`.tar`,
     2  `.tar.gz`, `.tgz`, `.bzip`, `.tar.xz`, `.txz`) into it, then optionally tag it.
     3  
     4  
     5  # EXAMPLES
     6  
     7  ## Import from a remote location
     8  
     9      # docker image import http://example.com/exampleimage.tgz example/imagerepo
    10  
    11  ## Import from a local file
    12  
    13  Import to docker via pipe and stdin:
    14  
    15      # cat exampleimage.tgz | docker image import - example/imagelocal
    16  
    17  Import with a commit message. 
    18  
    19      # cat exampleimage.tgz | docker image import --message "New image imported from tarball" - exampleimagelocal:new
    20  
    21  Import to a Docker image from a local file.
    22  
    23      # docker image import /path/to/exampleimage.tgz 
    24  
    25  
    26  ## Import from a local file and tag
    27  
    28  Import to docker via pipe and stdin:
    29  
    30      # cat exampleimageV2.tgz | docker image import - example/imagelocal:V-2.0
    31  
    32  ## Import from a local directory
    33  
    34      # tar -c . | docker image import - exampleimagedir
    35  
    36  ## Apply specified Dockerfile instructions while importing the image
    37  This example sets the docker image ENV variable DEBUG to true by default.
    38  
    39      # tar -c . | docker image import -c="ENV DEBUG=true" - exampleimagedir
    40  
    41  ## When the daemon supports multiple operating systems
    42  If the daemon supports multiple operating systems, and the image being imported
    43  does not match the default operating system, it may be necessary to add
    44  `--platform`. This would be necessary when importing a Linux image into a Windows
    45  daemon.
    46  
    47      # docker image import --platform=linux .\linuximage.tar
    48  
    49  # See also
    50  **docker-export(1)** to export the contents of a filesystem as a tar archive to STDOUT.