.nh
.TH "DOCKER" "1" "May 2024" "Docker Community" "Docker User Manuals"

.SH NAME
.PP
docker-image-push - Upload an image to a registry


.SH SYNOPSIS
.PP
\fBdocker image push [OPTIONS] NAME[:TAG]\fP


.SH DESCRIPTION
.PP
Use \fBdocker image push\fR to share your images to the Docker Hub
\[la]https://hub.docker.com\[ra]
registry or to a self-hosted one.

.PP
Refer to \fBdocker-image-tag(1)\fP for more information about valid image and tag names.

.PP
Killing the \fBdocker image push\fP process, for example by pressing \fBCTRL-c\fP while it
is running in a terminal, terminates the push operation.

.PP
Registry credentials are managed by \fBdocker-login(1)\fP\&.


.SH EXAMPLES
.SH Pushing a new image to a registry
.PP
First save the new image by finding the container ID (using \fBdocker container ls\fP)
and then committing it to a new image name.  Note that only a-z0-9-_. are
allowed when naming images:

.EX
# docker container commit c16378f943fe rhel-httpd

.EE

.PP
Now, push the image to the registry using the image ID. In this example the
registry is on host named \fBregistry-host\fR and listening on port \fB5000\fR\&. To do
this, tag the image with the host name or IP address, and the port of the
registry:

.EX
# docker image tag rhel-httpd registry-host:5000/myadmin/rhel-httpd:latest
# docker image push registry-host:5000/myadmin/rhel-httpd:latest

.EE

.PP
Check that this worked by running:

.EX
# docker image ls

.EE

.PP
You should see both \fBrhel-httpd\fR and \fBregistry-host:5000/myadmin/rhel-httpd\fR
listed.

.SS Push all tags of an image
.PP
Use the \fB-a\fR (or \fB--all-tags\fR) option to push all tags of a local image.

.PP
The following example creates multiple tags for an image, and pushes all those
tags to Docker Hub.

.EX
$ 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

.EE

.PP
The image is now tagged under multiple names:

.EX
$ 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

.EE

.PP
When pushing with the \fB--all-tags\fR option, all tags of the \fBregistry-host:5000/myname/myimage\fR
image are pushed:

.EX
$ 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

.EE


.SH OPTIONS
.PP
\fB-a\fP, \fB--all-tags\fP[=false]
	Push all tags of an image to the repository

.PP
\fB--disable-content-trust\fP[=true]
	Skip image signing

.PP
\fB-h\fP, \fB--help\fP[=false]
	help for push

.PP
\fB-q\fP, \fB--quiet\fP[=false]
	Suppress verbose output


.SH SEE ALSO
.PP
\fBdocker-image(1)\fP
