github.com/justincormack/cli@v0.0.0-20201215022714-831ebeae9675/man/src/image/push.md (about)

     1  Use `docker image push` to share your images to the [Docker Hub](https://hub.docker.com)
     2  registry or to a self-hosted one.
     3  
     4  Refer to **docker-image-tag(1)** for more information about valid image and tag names.
     5  
     6  Killing the **docker image push** process, for example by pressing **CTRL-c** while it
     7  is running in a terminal, terminates the push operation.
     8  
     9  Registry credentials are managed by **docker-login(1)**.
    10  
    11  # EXAMPLES
    12  
    13  ## Pushing a new image to a registry
    14  
    15  First save the new image by finding the container ID (using **docker container ls**)
    16  and then committing it to a new image name.  Note that only a-z0-9-_. are
    17  allowed when naming images:
    18  
    19      # docker container commit c16378f943fe rhel-httpd
    20  
    21  Now, push the image to the registry using the image ID. In this example the
    22  registry is on host named `registry-host` and listening on port `5000`. To do
    23  this, tag the image with the host name or IP address, and the port of the
    24  registry:
    25  
    26      # docker image tag rhel-httpd registry-host:5000/myadmin/rhel-httpd:latest
    27      # docker image push registry-host:5000/myadmin/rhel-httpd:latest
    28  
    29  Check that this worked by running:
    30  
    31      # docker image ls
    32  
    33  You should see both `rhel-httpd` and `registry-host:5000/myadmin/rhel-httpd`
    34  listed.
    35  
    36  ### Push all tags of an image
    37  
    38  Use the `-a` (or `--all-tags`) option to push To push all tags of a local image.
    39  
    40  The following example creates multiple tags for an image, and pushes all those
    41  tags to Docker Hub.
    42  
    43      $ docker image tag myimage registry-host:5000/myname/myimage:latest
    44      $ docker image tag myimage registry-host:5000/myname/myimage:v1.0.1
    45      $ docker image tag myimage registry-host:5000/myname/myimage:v1.0
    46      $ docker image tag myimage registry-host:5000/myname/myimage:v1
    47  
    48  The image is now tagged under multiple names:
    49  
    50      $ docker image ls
    51      
    52      REPOSITORY                          TAG        IMAGE ID       CREATED      SIZE
    53      myimage                             latest     6d5fcfe5ff17   2 hours ago  1.22MB
    54      registry-host:5000/myname/myimage   latest     6d5fcfe5ff17   2 hours ago  1.22MB
    55      registry-host:5000/myname/myimage   v1         6d5fcfe5ff17   2 hours ago  1.22MB
    56      registry-host:5000/myname/myimage   v1.0       6d5fcfe5ff17   2 hours ago  1.22MB
    57      registry-host:5000/myname/myimage   v1.0.1     6d5fcfe5ff17   2 hours ago  1.22MB
    58  
    59  When pushing with the `--all-tags` option, all tags of the `registry-host:5000/myname/myimage`
    60  image are pushed:
    61  
    62  
    63      $ docker image push --all-tags registry-host:5000/myname/myimage
    64      
    65      The push refers to repository [registry-host:5000/myname/myimage]
    66      195be5f8be1d: Pushed
    67      latest: digest: sha256:edafc0a0fb057813850d1ba44014914ca02d671ae247107ca70c94db686e7de6 size: 4527
    68      195be5f8be1d: Layer already exists
    69      v1: digest: sha256:edafc0a0fb057813850d1ba44014914ca02d671ae247107ca70c94db686e7de6 size: 4527
    70      195be5f8be1d: Layer already exists
    71      v1.0: digest: sha256:edafc0a0fb057813850d1ba44014914ca02d671ae247107ca70c94db686e7de6 size: 4527
    72      195be5f8be1d: Layer already exists
    73      v1.0.1: digest: sha256:edafc0a0fb057813850d1ba44014914ca02d671ae247107ca70c94db686e7de6 size: 4527