import.rst 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. :title: Import Command
  2. :description: Create a new filesystem image from the contents of a tarball
  3. :keywords: import, tarball, docker, url, documentation
  4. ==========================================================================
  5. ``import`` -- Create a new filesystem image from the contents of a tarball
  6. ==========================================================================
  7. ::
  8. Usage: docker import URL|- [REPOSITORY [TAG]]
  9. Create a new filesystem image from the contents of a tarball
  10. At this time, the URL must start with ``http`` and point to a single file archive
  11. (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz)
  12. containing a root filesystem. If you would like to import from a local directory or archive,
  13. you can use the ``-`` parameter to take the data from standard in.
  14. Examples
  15. --------
  16. Import from a remote location
  17. .............................
  18. ``$ docker import http://example.com/exampleimage.tgz exampleimagerepo``
  19. Import from a local file
  20. ........................
  21. Import to docker via pipe and standard in
  22. ``$ cat exampleimage.tgz | docker import - exampleimagelocal``
  23. Import from a local directory
  24. .............................
  25. ``$ sudo tar -c . | docker import - exampleimagedir``
  26. Note the ``sudo`` in this example -- you must preserve the ownership of the files (especially root ownership)
  27. during the archiving with tar. If you are not root (or sudo) when you tar, then the ownerships might not get preserved.