🐳 Docker Beginner

What is docker pull and docker push?

Why Interviewers Ask This

This is a classic screening question for Docker roles. Hiring managers ask it early in interviews to gauge your baseline understanding and determine if you can communicate technical concepts clearly.

Answer

docker pull downloads a Docker image from a registry to your local machine. Syntax: docker pull image[:tag]. Examples: docker pull nginx:1.25 — pull specific version (always pin versions!); docker pull node:20-alpine; docker pull ghcr.io/username/myapp:1.0 — from GitHub Container Registry. Docker pull only downloads layers not already cached locally — subsequent pulls of images sharing layers are fast. For multi-platform: docker pull --platform linux/amd64 node:20. docker push uploads a local image to a registry. You must be authenticated and the image must be tagged with the full registry path. Steps: (1) Login: docker login (Docker Hub) or docker login ghcr.io -u username --password-stdin; (2) Tag: docker tag myapp:1.0 ghcr.io/username/myapp:1.0; (3) Push: docker push ghcr.io/username/myapp:1.0. Docker pushes only layers not already in the registry. Multiple tags: you can push the same image with different tags: docker tag myapp:1.0 myapp:latest && docker push myapp:latest. Efficient workflow in CI/CD: build → tag → push to registry → trigger deployment (pull from registry to target servers or Kubernetes).

Pro Tip

Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a Docker codebase.