Originally published on docker.learnio.dev — part of the Docker fundamentals course. View this lesson on the original site.
Exercise: pull and smoke-test an image
Practice the chapter 2 verification habit: pull a public image, run it, prove it answers HTTP, and inspect what Docker stored locally.
Work through the steps before you open the solution lesson.
Goal
- pull
nginx:stable-alpinefrom a registry - run it with a published port on loopback
- confirm HTTP with
curl - inspect tags and digests on your machine
Tasks
- Pull the image:
docker pull nginx:stable-alpine
-
Run it in the background with name
smoke-nginx, publishing container port80to127.0.0.1:8080. -
Confirm HTTP responds:
curl -I http://127.0.0.1:8080
- List the image with digest information:
docker image ls --digests nginx
- Inspect one line of identity metadata:
docker image inspect --format '{{.RepoTags}} {{.RepoDigests}}' nginx:stable-alpine
- Read recent container logs, then stop and remove the container.
Checklist
-
curlreturns a successful HTTP status (for example200) -
docker image ls --digestsshows a repo digest for the image - You can explain the difference between the tag you used and the digest Docker recorded
What is next
Open Solution: pull and smoke-test an image, then take the chapter 2 quiz.
GitHub example
Academy repo: 2-images-layers/exercise-pull-smoke
From Docker fundamentals — Images, layers, tags, and everyday commands