ScanSkill

docker push

You can use docker image push OR docker push to push an image or a repository to a registry(Docker Hub or any other self-hosted one).

Syntax

$ docker push [OPTIONS] NAME[:TAG]

Here,

Options:

  • --all-tags, -a → Push all tagged images in the repository
  • --disable-content-trust → Skip image signing
  • --quiet, -q → Suppress verbose output

Note: All registry credentials are managed by docker login. Know more

Examples

  • Push a new image to a registry

First, you have to save the new image of the container and then commit it to a new image name.

$ docker container commit c423234f34fe34 arch-demo:latest

Then tag the image with hostname or IP address and port. After that push the image to the registry.

$ docker image tag arch-demo:latest registry:5000/admin/arch-demo:latest

$ docker image push registry:5000/admin/arch-demo:latest

Note: Here, registry is your registry host.

  • Push all tags of an image
$ docker image tag myImage registry:5000/myName/myImage:latest
$ docker image tag myImage registry:5000/myName/myImage:v1
$ docker image tag myImage registry:5000/myName/myImage:v1.0.1
$ docker image tag myImage registry:5000/myName/myImage:v1.0

Then push with —all-tags or -a flag. It will push all tags of the registry:5000/myName/myImage.

$ docker image push --all-tags registry:5000/myName/myImage