Interview Q&A / Docker & Kubernetes

BeginnerQuick answer1 min readUpdated 3 Oct 2026

How do you push a locally built image to a registry?

SHORT ANSWER

Tag the image with the registry's full name, log in with docker login, then run docker push. The tag must include the registry host and repository name, or Docker pushes to Docker Hub.

Explain it simply

Sending a parcel needs the right address on the label. In Docker the tag is the label: it says which registry, which repository, which version.

Steps: build the image, docker tag myapp:latest registry.example.com/team/myapp:1.0.0 to add a second name pointing to the same image, docker login registry.example.com to authenticate, then docker push registry.example.com/team/myapp:1.0.0. Docker uploads only the layers the registry does not already have, so repeated pushes are quick. Anyone with access then runs docker pull with the same name.

In CI, log in with a token or service account, not your personal password, and tag with the Git commit SHA or a version so each push is traceable.

Example

bash
docker build -t myapp:latest .
docker tag myapp:latest ghcr.io/shubham/myapp:1.0.0
echo $TOKEN | docker login ghcr.io -u shubham --password-stdin
docker push ghcr.io/shubham/myapp:1.0.0

What to say in the interview

"I build, tag the image with the full registry path and a version, docker login, then docker push. Only missing layers are uploaded. In CI I authenticate with a token and tag by version or commit SHA."

Common mistakes

  • Tagging only as myapp:latest, so the push targets Docker Hub or fails.

#docker#registry#push

Related questions

Practise more Docker & Kubernetes questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Docker & Kubernetes quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.