diff options
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fimport%2Findex.html')
| -rw-r--r-- | devdocs/docker/engine%2Freference%2Fcommandline%2Fimport%2Findex.html | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fimport%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fimport%2Findex.html new file mode 100644 index 00000000..477eb5c3 --- /dev/null +++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fimport%2Findex.html @@ -0,0 +1,17 @@ +<h1>docker import</h1> <p><br></p> <p>Import the contents from a tarball to create a filesystem image</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]] +</pre></div> <p>Refer to the <a href="#options">options section</a> for an overview of available <a href="#options"><code class="language-plaintext highlighter-rouge">OPTIONS</code></a> for this command.</p> <h2 id="description">Description</h2> <p name="extended-description">You can specify a <code class="language-plaintext highlighter-rouge">URL</code> or <code class="language-plaintext highlighter-rouge">-</code> (dash) to take data directly from <code class="language-plaintext highlighter-rouge">STDIN</code>. The <code class="language-plaintext highlighter-rouge">URL</code> can point to an archive (.tar, .tar.gz, .tgz, .bzip, .tar.xz, or .txz) containing a filesystem or to an individual file on the Docker host. If you specify an archive, Docker untars it in the container relative to the <code class="language-plaintext highlighter-rouge">/</code> (root). If you specify an individual file, you must specify the full path within the host. To import from a remote location, specify a <code class="language-plaintext highlighter-rouge">URI</code> that begins with the <code class="language-plaintext highlighter-rouge">http://</code> or <code class="language-plaintext highlighter-rouge">https://</code> protocol.</p> <p>The <code class="language-plaintext highlighter-rouge">--change</code> option applies <code class="language-plaintext highlighter-rouge">Dockerfile</code> instructions to the image that is created. Supported <code class="language-plaintext highlighter-rouge">Dockerfile</code> instructions: <code class="language-plaintext highlighter-rouge">CMD</code>|<code class="language-plaintext highlighter-rouge">ENTRYPOINT</code>|<code class="language-plaintext highlighter-rouge">ENV</code>|<code class="language-plaintext highlighter-rouge">EXPOSE</code>|<code class="language-plaintext highlighter-rouge">ONBUILD</code>|<code class="language-plaintext highlighter-rouge">USER</code>|<code class="language-plaintext highlighter-rouge">VOLUME</code>|<code class="language-plaintext highlighter-rouge">WORKDIR</code></p> <p>For example uses of this command, refer to the <a href="#examples">examples section</a> below.</p> <h2 id="options">Options</h2> <table> <thead> <tr> <td>Name, shorthand</td> <td>Default</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td> +<code class="language-plaintext highlighter-rouge">--change</code> , <code class="language-plaintext highlighter-rouge">-c</code> +</td> <td></td> <td>Apply Dockerfile instruction to the created image</td> </tr> <tr> <td> +<code class="language-plaintext highlighter-rouge">--message</code> , <code class="language-plaintext highlighter-rouge">-m</code> +</td> <td></td> <td>Set commit message for imported image</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--platform</code></td> <td></td> <td>Set platform if server is multi-platform capable</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <h3 id="import-from-a-remote-location">Import from a remote location</h3> <p>This creates a new untagged image.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker import https://example.com/exampleimage.tgz +</pre></div> <h3 id="import-from-a-local-file">Import from a local file</h3> <p>Import to docker via pipe and <code class="language-plaintext highlighter-rouge">STDIN</code>.</p> <div class="highlight"><pre class="highlight" data-language="">$ cat exampleimage.tgz | docker import - exampleimagelocal:new +</pre></div> <p>Import with a commit message.</p> <div class="highlight"><pre class="highlight" data-language="">$ cat exampleimage.tgz | docker import --message "New image imported from tarball" - exampleimagelocal:new +</pre></div> <p>Import to docker from a local archive.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker import /path/to/exampleimage.tgz +</pre></div> <h3 id="import-from-a-local-directory">Import from a local directory</h3> <div class="highlight"><pre class="highlight" data-language="">$ sudo tar -c . | docker import - exampleimagedir +</pre></div> <h3 id="import-from-a-local-directory-with-new-configurations">Import from a local directory with new configurations</h3> <div class="highlight"><pre class="highlight" data-language="">$ sudo tar -c . | docker import --change "ENV DEBUG=true" - exampleimagedir +</pre></div> <p>Note the <code class="language-plaintext highlighter-rouge">sudo</code> 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 the sudo command) when you tar, then the ownerships might not get preserved.</p> <div class="_attribution"> + <p class="_attribution-p"> + © 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br> + <a href="https://docs.docker.com/engine/reference/commandline/import/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/import/</a> + </p> +</div> |
