2016-10-14 18:30:36 -04:00
|
|
|
---
|
|
|
|
title: "push"
|
|
|
|
description: "The push command description and usage"
|
2016-11-03 18:48:30 -04:00
|
|
|
keywords: "share, push, image"
|
2016-10-14 18:30:36 -04:00
|
|
|
---
|
2015-06-21 16:41:38 -04:00
|
|
|
|
2016-10-19 13:25:45 -04:00
|
|
|
<!-- This file is maintained within the docker/docker Github
|
|
|
|
repository at https://github.com/docker/docker/. Make all
|
|
|
|
pull requests against that repo. If you see this file in
|
|
|
|
another repository, consider it read-only there, as it will
|
|
|
|
periodically be overwritten by the definitive file. Pull
|
|
|
|
requests which include edits to this file in other repositories
|
|
|
|
will be rejected.
|
|
|
|
-->
|
|
|
|
|
2015-06-21 16:41:38 -04:00
|
|
|
# push
|
|
|
|
|
2016-07-07 14:43:18 -04:00
|
|
|
```markdown
|
|
|
|
Usage: docker push [OPTIONS] NAME[:TAG]
|
2015-06-21 16:41:38 -04:00
|
|
|
|
2016-07-07 14:43:18 -04:00
|
|
|
Push an image or a repository to a registry
|
2015-06-21 16:41:38 -04:00
|
|
|
|
2016-07-07 14:43:18 -04:00
|
|
|
Options:
|
|
|
|
--disable-content-trust Skip image verification (default true)
|
|
|
|
--help Print usage
|
|
|
|
```
|
2015-07-07 23:14:47 -04:00
|
|
|
|
2015-06-21 16:41:38 -04:00
|
|
|
Use `docker push` to share your images to the [Docker Hub](https://hub.docker.com)
|
|
|
|
registry or to a self-hosted one.
|
2016-09-15 12:53:46 -04:00
|
|
|
|
|
|
|
Refer to the [`docker tag`](tag.md) reference for more information about valid
|
|
|
|
image and tag names.
|
2015-12-09 14:26:07 -05:00
|
|
|
|
|
|
|
Killing the `docker push` process, for example by pressing `CTRL-c` while it is
|
2016-09-15 12:53:46 -04:00
|
|
|
running in a terminal, terminates the push operation.
|
2016-03-28 20:10:11 -04:00
|
|
|
|
|
|
|
Registry credentials are managed by [docker login](login.md).
|
2016-09-15 12:53:46 -04:00
|
|
|
|
2016-09-17 23:00:19 -04:00
|
|
|
## Examples
|
2016-09-15 12:53:46 -04:00
|
|
|
|
|
|
|
### Pushing a new image to a registry
|
|
|
|
|
|
|
|
First save the new image by finding the container ID (using [`docker ps`](ps.md))
|
|
|
|
and then committing it to a new image name. Note that only `a-z0-9-_.` are
|
|
|
|
allowed when naming images:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker commit c16378f943fe rhel-httpd
|
|
|
|
```
|
|
|
|
|
|
|
|
Now, push the image to the registry using the image ID. In this example the
|
|
|
|
registry is on host named `registry-host` and listening on port `5000`. To do
|
|
|
|
this, tag the image with the host name or IP address, and the port of the
|
|
|
|
registry:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker tag rhel-httpd registry-host:5000/myadmin/rhel-httpd
|
|
|
|
$ docker push registry-host:5000/myadmin/rhel-httpd
|
|
|
|
```
|
|
|
|
|
|
|
|
Check that this worked by running:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker images
|
|
|
|
```
|
|
|
|
|
|
|
|
You should see both `rhel-httpd` and `registry-host:5000/myadmin/rhel-httpd`
|
|
|
|
listed.
|