Table of Contents

Docker Pulling and pushing

Pulling fetches images from a registry to your local machine. Pushing sends local images to a registry. Before pushing, tag the image with the registry hostname. Authentication is required for private registries via docker login.

$ docker pull ubuntu:latest                   # pull from Docker Hub
$ docker pull myregistry.com/myapp:1.0        # pull from private registry
$ docker tag myapp:1.0 myregistry.com/myapp   # tag for pushing
$ docker push myregistry.com/myapp:1.0        # push to private registry
$ docker pull myregistry.com/myapp:latest     # pull the pushed image

When you pull, Docker checks if the image exists locally first—if it does and the digest matches, no download occurs. If the image hasn't been pulled before or is outdated, Docker downloads the layers from the registry and stores them in your local image store. You cannot push to a registry without proper credentials; use docker login first for private registries.