LESSON · 1 OF 6

docker pull

docker pull

docker run pulls an image automatically when it is missing, but often you want to download an image ahead of time without running it - to warm a cache before a demo, or to grab a specific version. That is what docker pull does:

bash
docker pull redis

Docker contacts the registry, downloads the image, and stores it locally. Next time you run or pull it, nothing downloads.

Images come in layers

Watch the output of a pull and you will see several lines, each with its own progress bar, ending in "Pull complete". Each line is a layer. An image is built from stacked read-only layers, and Docker downloads them separately.

This layering pays off. If two images share a base layer - say both build on debian - Docker stores that layer once and reuses it. Pull a second image that shares layers with one you already have and those layers show as "Already exists" instead of downloading again.

Where images come from by default

When you pull redis, Docker expands it to docker.io/library/redis and fetches from Docker Hub. docker.io is the default registry and library is the namespace for official images. You only spell out the full path when pulling from a different registry, which comes up later in the skill.

Commands this node introduces

  • docker pull IMAGE - download an image without running it
Spin up a fresh environment and practice live.
docker · fresh machine · ready in under a minute