1
0
mirror of https://github.com/docker/cli.git synced 2026-01-15 07:40:57 +03:00
Files
cli/components/engine/docs/sources/commandline/command/import.rst
Andy Rothfusz fd36c14020 Fix #1517, #1521 by adding sudo to examples and installation.
Upstream-commit: d4eab77f0c604e10f63519833dc25fbd5a3419bf
Component: engine
2013-08-14 16:21:36 -07:00

1.4 KiB

title
Import Command
description
Create a new filesystem image from the contents of a tarball
keywords
import, tarball, docker, url, documentation

import -- Create a new filesystem image from the contents of a tarball

Usage: docker import URL|- [REPOSITORY [TAG]]

Create a new filesystem image from the contents of a tarball

At this time, the URL must start with http and point to a single file archive (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) containing a root filesystem. If you would like to import from a local directory or archive, you can use the - parameter to take the data from standard in.

Examples

Import from a remote location

$ sudo docker import http://example.com/exampleimage.tgz exampleimagerepo

Import from a local file

Import to docker via pipe and standard in

$ cat exampleimage.tgz | sudo docker import - exampleimagelocal

Import from a local directory

$ sudo tar -c . | docker import - exampleimagedir

Note the sudo in this example -- you must preserve the ownership of the files (especially root ownership) during the archiving with tar. If you are not root (or sudo) when you tar, then the ownerships might not get preserved.