summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fpush%2Findex.html
blob: bcac30baaafbd6384322e191e1130fcd962b3df4 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
<h1>docker push</h1>  <p><br></p> <p>Push an image or a repository to a registry</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker push [OPTIONS] NAME[: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">Use <code class="language-plaintext highlighter-rouge">docker image push</code> to share your images to the <a href="https://hub.docker.com">Docker Hub</a> registry or to a self-hosted one.</p> <p>Refer to the <a href="../tag/index"><code class="language-plaintext highlighter-rouge">docker image tag</code></a> reference for more information about valid image and tag names.</p> <p>Killing the <code class="language-plaintext highlighter-rouge">docker image push</code> process, for example by pressing <code class="language-plaintext highlighter-rouge">CTRL-c</code> while it is running in a terminal, terminates the push operation.</p> <p>Progress bars are shown during docker push, which show the uncompressed size. The actual amount of data that’s pushed will be compressed before sending, so the uploaded size will not be reflected by the progress bar.</p> <p>Registry credentials are managed by <a href="../login/index">docker login</a>.</p> <h3 id="concurrent-uploads">Concurrent uploads</h3> <p>By default the Docker daemon will push five layers of an image at a time. If you are on a low bandwidth connection this may cause timeout issues and you may want to lower this via the <code class="language-plaintext highlighter-rouge">--max-concurrent-uploads</code> daemon option. See the <a href="../dockerd/index">daemon documentation</a> for more details.</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">--all-tags</code> , <code class="language-plaintext highlighter-rouge">-a</code>
</td> <td></td> <td>Push all tagged images in the repository</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--disable-content-trust</code></td> <td><code class="language-plaintext highlighter-rouge">true</code></td> <td>Skip image signing</td> </tr> <tr> <td>
<code class="language-plaintext highlighter-rouge">--quiet</code> , <code class="language-plaintext highlighter-rouge">-q</code>
</td> <td></td> <td>Suppress verbose output</td> </tr>  </tbody> </table>  <h2 id="examples">Examples</h2> <h3 id="push-a-new-image-to-a-registry">Push a new image to a registry</h3> <p>First save the new image by finding the container ID (using <a href="../ps/index"><code class="language-plaintext highlighter-rouge">docker container ls</code></a>) and then committing it to a new image name. Note that only <code class="language-plaintext highlighter-rouge">a-z0-9-_.</code> are allowed when naming images:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker container commit c16378f943fe rhel-httpd:latest
</pre></div> <p>Now, push the image to the registry using the image ID. In this example the registry is on host named <code class="language-plaintext highlighter-rouge">registry-host</code> and listening on port <code class="language-plaintext highlighter-rouge">5000</code>. To do this, tag the image with the host name or IP address, and the port of the registry:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker image tag rhel-httpd:latest registry-host:5000/myadmin/rhel-httpd:latest

$ docker image push registry-host:5000/myadmin/rhel-httpd:latest
</pre></div> <p>Check that this worked by running:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker image ls
</pre></div> <p>You should see both <code class="language-plaintext highlighter-rouge">rhel-httpd</code> and <code class="language-plaintext highlighter-rouge">registry-host:5000/myadmin/rhel-httpd</code> listed.</p> <h3 id="push-all-tags-of-an-image">Push all tags of an image</h3> <p>Use the <code class="language-plaintext highlighter-rouge">-a</code> (or <code class="language-plaintext highlighter-rouge">--all-tags</code>) option to push all tags of a local image.</p> <p>The following example creates multiple tags for an image, and pushes all those tags to Docker Hub.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker image tag myimage registry-host:5000/myname/myimage:latest
$ docker image tag myimage registry-host:5000/myname/myimage:v1.0.1
$ docker image tag myimage registry-host:5000/myname/myimage:v1.0
$ docker image tag myimage registry-host:5000/myname/myimage:v1
</pre></div> <p>The image is now tagged under multiple names:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker image ls

REPOSITORY                          TAG        IMAGE ID       CREATED      SIZE
myimage                             latest     6d5fcfe5ff17   2 hours ago  1.22MB
registry-host:5000/myname/myimage   latest     6d5fcfe5ff17   2 hours ago  1.22MB
registry-host:5000/myname/myimage   v1         6d5fcfe5ff17   2 hours ago  1.22MB
registry-host:5000/myname/myimage   v1.0       6d5fcfe5ff17   2 hours ago  1.22MB
registry-host:5000/myname/myimage   v1.0.1     6d5fcfe5ff17   2 hours ago  1.22MB
</pre></div> <p>When pushing with the <code class="language-plaintext highlighter-rouge">--all-tags</code> option, all tags of the <code class="language-plaintext highlighter-rouge">registry-host:5000/myname/myimage</code> image are pushed:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker image push --all-tags registry-host:5000/myname/myimage

The push refers to repository [registry-host:5000/myname/myimage]
195be5f8be1d: Pushed
latest: digest: sha256:edafc0a0fb057813850d1ba44014914ca02d671ae247107ca70c94db686e7de6 size: 4527
195be5f8be1d: Layer already exists
v1: digest: sha256:edafc0a0fb057813850d1ba44014914ca02d671ae247107ca70c94db686e7de6 size: 4527
195be5f8be1d: Layer already exists
v1.0: digest: sha256:edafc0a0fb057813850d1ba44014914ca02d671ae247107ca70c94db686e7de6 size: 4527
195be5f8be1d: Layer already exists
v1.0.1: digest: sha256:edafc0a0fb057813850d1ba44014914ca02d671ae247107ca70c94db686e7de6 size: 4527
</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/push/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/push/</a>
  </p>
</div>