Pull Images and Inspect Docker Resources
Overview
Running docker run nginx can hide an important step: Docker first looks for a local image, and if it is missing, downloads the image from a registry. Pulling separately makes that behavior visible and lets you verify which tag or version exists locally.
Detailed Notes
Pull an exact image
docker pull nginx:1.27-alpine
The text before : is the repository name. The text after : is the tag. Docker Hub is used by default when no registry hostname is included.
Expected behavior:
- Docker asks the registry for the requested tag.
- The registry returns a manifest listing image layers.
- Docker downloads only missing layers.
- The image becomes available in the local image cache.
Inspect local resources
docker images
docker image ls
docker image inspect nginx:1.27-alpine
docker history nginx:1.27-alpine
docker imagesanddocker image lslist downloaded images.inspectprints configuration in JSON, including architecture, environment, entrypoint and exposed ports.historyshows how the image was assembled and the size contributed by each step.
To remove an image:
docker rmi nginx:1.27-alpine
Docker refuses removal if a container still depends on the image. Remove the container first, or use docker rm -f CONTAINER_NAME only when the running container is no longer needed.
Practice
Pull nginx:1.27-alpine, list it, inspect it and run:
docker run --rm nginx:1.27-alpine nginx -v
This is an example of overriding the image's default command. The container starts, prints the Nginx version and exits.
Common Interview Questions
Finished this lesson?
0 of 27 lessons done · 0% of the course

