- Pull images from public and private registries
- Authenticate with
docker login - Retag (rename) images
- Push images to private registries
- Inspect actual disk usage with Docker
1. Pulling Images from a Public Registry
Pulling from a public registry (for example, the official Ubuntu image on Docker Hub) requires no authentication:By default,
docker pull ubuntu retrieves the latest tag. To pull a specific version, append the tag (e.g., ubuntu:20.04).2. Accessing Private Repositories
Attempting to pull an image from a private registry without logging in will result in an access denied error:You must authenticate before pulling from or pushing to private registries.
Make sure your credentials have the necessary permissions.
Make sure your credentials have the necessary permissions.
3. Logging In to a Registry
Usedocker login to authenticate. By default, it targets Docker Hub (docker.io).
docker pull and docker push commands will use your credentials.
4. Retagging (Renaming) an Image
Docker images cannot be renamed directly. Instead, you can create a new tag—a “soft link” to the same image ID.- List local images:
- Retag
httpd:alpinetohttpd:customv1: - Confirm the new tag:
httpd:alpine and httpd:customv1 share the same IMAGE ID—no duplicate layers are created.
5. Pushing to a Private Registry
To push your retagged image:docker login gcr.io) before pushing.
6. Checking Actual Disk Usage
Usedocker system df to inspect disk usage across images, containers, volumes, and build cache:
docker image ls lists four tags, docker system df shows only three unique images. The SIZE column reflects unique layers, and RECLAIMABLE indicates potential space savings.
Command Reference Table
| Action | Command Example |
|---|---|
| Pull a public image | docker pull ubuntu |
| Pull a private image | docker pull gcr.io/myorg/ubuntu |
| Login to Docker Hub | docker login docker.io |
| Login to Google Container Reg. | docker login gcr.io |
| Retag an image | docker image tag httpd:alpine httpd:customv1 |
| Push to a private registry | docker push gcr.io/organization/httpd:customv1 |
| View disk usage | docker system df |