import.rst 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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
  11. file archive (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) containing a
  12. root filesystem. If you would like to import from a local directory or
  13. archive, you can use the ``-`` parameter to take the data from
  14. standard in.
  15. Examples
  16. --------
  17. Import from a remote location
  18. .............................
  19. ``$ sudo docker import http://example.com/exampleimage.tgz exampleimagerepo``
  20. Import from a local file
  21. ........................
  22. Import to docker via pipe and standard in
  23. ``$ cat exampleimage.tgz | sudo docker import - exampleimagelocal``
  24. Import from a local directory
  25. .............................
  26. ``$ sudo tar -c . | docker import - exampleimagedir``
  27. Note the ``sudo`` in this example -- you must preserve the ownership
  28. of the files (especially root ownership) during the archiving with
  29. tar. If you are not root (or sudo) when you tar, then the ownerships
  30. might not get preserved.