github.com/slene/docker@v1.8.0-rc1/docs/reference/commandline/import.md (about) 1 <!--[metadata]> 2 +++ 3 title = "import" 4 description = "The import command description and usage" 5 keywords = ["import, file, system, container"] 6 [menu.main] 7 parent = "smn_cli" 8 weight=1 9 +++ 10 <![end-metadata]--> 11 12 # import 13 14 Usage: docker import URL|- [REPOSITORY[:TAG]] 15 16 Create an empty filesystem image and import the contents of the 17 tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then 18 optionally tag it. 19 20 -c, --change=[] Apply specified Dockerfile instructions while importing the image 21 22 URLs must start with `http` and point to a single file archive (.tar, 23 .tar.gz, .tgz, .bzip, .tar.xz, or .txz) containing a root filesystem. If 24 you would like to import from a local directory or archive, you can use 25 the `-` parameter to take the data from `STDIN`. 26 27 The `--change` option will apply `Dockerfile` instructions to the image 28 that is created. 29 Supported `Dockerfile` instructions: 30 `CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR` 31 32 ## Examples 33 34 **Import from a remote location:** 35 36 This will create a new untagged image. 37 38 $ docker import http://example.com/exampleimage.tgz 39 40 **Import from a local file:** 41 42 Import to docker via pipe and `STDIN`. 43 44 $ cat exampleimage.tgz | docker import - exampleimagelocal:new 45 46 **Import from a local directory:** 47 48 $ sudo tar -c . | docker import - exampleimagedir 49 50 **Import from a local directory with new configurations:** 51 52 $ sudo tar -c . | docker import --change "ENV DEBUG true" - exampleimagedir 53 54 Note the `sudo` in this example – you must preserve 55 the ownership of the files (especially root ownership) during the 56 archiving with tar. If you are not root (or the sudo command) when you 57 tar, then the ownerships might not get preserved. 58