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-alpine from a registry
  • run it with a published port on loopback
  • confirm HTTP with curl
  • inspect tags and digests on your machine

Tasks

  1. Pull the image:
docker pull nginx:stable-alpine
  1. Run it in the background with name smoke-nginx, publishing container port 80 to 127.0.0.1:8080.

  2. Confirm HTTP responds:

curl -I http://127.0.0.1:8080
  1. List the image with digest information:
docker image ls --digests nginx
  1. Inspect one line of identity metadata:
docker image inspect --format '{{.RepoTags}} {{.RepoDigests}}' nginx:stable-alpine
  1. Read recent container logs, then stop and remove the container.

Checklist

  • curl returns a successful HTTP status (for example 200)
  • docker image ls --digests shows 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