summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fsave%2Findex.html
blob: 51dbc3132b6b2efb8d260f37b9c05d7facd02547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<h1>docker save</h1>  <p><br></p> <p>Save one or more images to a tar archive (streamed to STDOUT by default)</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker save [OPTIONS] IMAGE [IMAGE...]
</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">Produces a tarred repository to the standard output stream. Contains all parent layers, and all tags + versions, or specified <code class="language-plaintext highlighter-rouge">repo:tag</code>, for each argument provided.</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">--output</code> , <code class="language-plaintext highlighter-rouge">-o</code>
</td> <td></td> <td>Write to a file, instead of STDOUT</td> </tr>  </tbody> </table>  <h2 id="examples">Examples</h2> <h3 id="create-a-backup-that-can-then-be-used-with-docker-load">Create a backup that can then be used with <code class="language-plaintext highlighter-rouge">docker load</code>.</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker save busybox &gt; busybox.tar

$ ls -sh busybox.tar

2.7M busybox.tar

$ docker save --output busybox.tar busybox

$ ls -sh busybox.tar

2.7M busybox.tar

$ docker save -o fedora-all.tar fedora

$ docker save -o fedora-latest.tar fedora:latest
</pre></div> <h3 id="save-an-image-to-a-targz-file-using-gzip">Save an image to a tar.gz file using gzip</h3> <p>You can use gzip to save the image file and make the backup smaller.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker save myimage:latest | gzip &gt; myimage_latest.tar.gz
</pre></div> <h3 id="cherry-pick-particular-tags">Cherry-pick particular tags</h3> <p>You can even cherry-pick particular tags of an image repository.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy
</pre></div> <div class="_attribution">
  <p class="_attribution-p">
    &copy; 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/save/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/save/</a>
  </p>
</div>