Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Docker push Command

Docker push Command

Docker Command ReferenceDocker Command Reference


docker push The command is used to push (upload) locally built Docker images to a Docker registry (such as Docker Hub or a private registry). This allows images to be shared and used in other systems or environments.

Syntax

docker push [OPTIONS] NAME[:TAG]

OPTIONS description:

** 1. Push an image with the default tag (latest)**



docker push myrepo/myimage

This pushes the local myrepo/myimage:latest image to Docker Hub.

** 2. Push an image with a specific tag**



docker push myrepo/myimage:1.0

This pushes the local myrepo/myimage:1.0 image to Docker Hub.

** 3. Push to a custom registry**



docker push myregistry.com/myrepo/myimage:mytag

This pushes the local myrepo/myimage:mytag image to the myregistry.com registry.

Example

Push an image to Docker Hub

1. Log in to Docker Hub



docker login

2. Build an image



docker build -t myrepo/myimage:1.0 .

3. Push the image to Docker Hub



docker push myrepo/myimage:1.0

Example output:



The push refers to repository [docker.io/myrepo/myimage]

d1e017099d17: Pushed

1.0: digest: sha256:12345abcdef... size: 1234

Push an image to a custom registry

1. Log in to a custom registry



docker login myregistry.com

2. Build an image



docker build -t myregistry.com/myrepo/myimage:mytag .

3. Push the image to a custom registry



docker push myregistry.com/myrepo/myimage:mytag

Example output:



The push refers to repository [myregistry.com/myrepo/myimage]

d1e017099d17: Pushed

mytag: digest: sha256:67890abcdef... size: 5678

Notes

docker push The command is a key tool for pushing local Docker images to a registry. By using it, users can easily share, deploy, and manage Docker images. When using it, ensure correct login and tag settings so that images can be pushed properly to the target registry.


Docker Command ReferenceDocker Command Reference