Originally published on docker.learnio.dev — part of the Docker fundamentals course. View this lesson on the original site.

Solution: pull and smoke-test an image

This walkthrough matches the exercise. Adjust ports if 8080 is already in use on your machine.

Step 1: Pull

docker pull nginx:stable-alpine

Docker downloads layer blobs from the registry and assembles them into a local image tagged nginx:stable-alpine.

Step 2: Run with a published port

docker run --rm -d --name smoke-nginx -p 127.0.0.1:8080:80 nginx:stable-alpine

If the name is already in use:

docker rm -f smoke-nginx
docker run --rm -d --name smoke-nginx -p 127.0.0.1:8080:80 nginx:stable-alpine

Step 3: Smoke-test HTTP

curl -I http://127.0.0.1:8080

You want a successful response line such as HTTP/1.1 200 OK.

Step 4: Inspect tags and digests

docker image ls --digests nginx
docker image inspect --format '{{.RepoTags}} {{.RepoDigests}}' nginx:stable-alpine

RepoTags lists human-friendly names. RepoDigests lists immutable manifest digests your engine recorded when the image was pulled.

Step 5: Logs and cleanup

docker logs --tail 20 smoke-nginx
docker stop smoke-nginx

--rm removes the container after it stops.

What you proved

  • a registry pull delivered a runnable image
  • a tag is enough to run locally, while digests document the exact content
  • a short smoke test catches many bad pulls before they reach a larger stack

Continue to the chapter 2 quiz.

GitHub example

Academy repo: 2-images-layers/exercise-pull-smoke

From Docker fundamentals — Images, layers, tags, and everyday commands