Docker Pull & Search
Learn how to pull Docker images from Docker Hub and search for the right ones using the CLI.
How to Pull Images
Pulling an image just means downloading it to your local machine. Here are the most common ways to do it:
# Download the latest version of nginx (simplest form)
docker pull nginx
# Download a specific version (always safer in production)
docker pull postgres:16
# Download a lightweight Alpine variant
docker pull python:3.12-alpine
# Download from a different registry (not Docker Hub)
docker pull gcr.io/google-samples/hello-app:1.0
# Download by digest (the most permanent, unchangeable reference)
docker pull ubuntu@sha256:77906da...
One thing that makes Docker smart: it downloads images in layers, and it caches those layers locally. If two images share the same base OS layer, Docker only downloads it once. This saves both time and disk space as you accumulate more images.
What Does the Pull Output Actually Mean?
When you pull an image, you'll see something like this:
7.2: Pulling from library/redis
a480a496ba95: Pull complete ← downloading the base OS layer
e2677dab5ef2: Pull complete ← installing packages on top
ca5b0a5ac559: Pull complete ← adding the Redis binary itself
Digest: sha256:e96c03a6dda7...
Status: Downloaded newer image for redis:7.2
Each line represents a layer - a piece of the image stacked on top of the previous one. If you've already pulled another image that shares a layer, you'll see Already exists instead of Pull complete. That's Docker being efficient and reusing what's already on your machine.
How to Search for Images
You can search Docker Hub right from your terminal without opening a browser:
# Search for any image by name
docker search nginx
# Limit results to the top 5
docker search --limit 5 postgres
# Only show images with at least 50 stars
docker search --filter stars=50 redis
# Only show official images
docker search --filter is-official=true python
The output looks something like this:
NAME DESCRIPTION STARS OFFICIAL
nginx Official build of Nginx. 19835 [OK]
unit Official build of NGINX Unit 80 [OK]
nginxinc/nginx-unprivileged ... 980
The [OK] in the OFFICIAL column is your signal that this is an officially maintained image. Images without it are community-contributed.
For seeing all available version tags, reading documentation, or checking security scan results, head to hub.docker.com and search there. The web UI gives you a lot more detail than the CLI.
Practice: Search and Pull from Docker Hub
The best way to get comfortable with these commands is to try them yourself. Here's a quick walkthrough:
# Step 1: Search for official Redis images on Docker Hub
docker search --filter is-official=true redis
# Step 2: Pull a specific version - never just "latest" in real projects
docker pull redis:7.2
# Step 3: Confirm the image downloaded successfully
docker images | grep redis
Notice the [OK] badge in the search results. This confirms Redis is an officially maintained image. And after pulling, docker images should show redis with the 7.2 tag, its image ID, and size.
Key Takeaways
docker pull <image>downloads an image to your machine - Docker Hub is the default source, so no extra configuration is needed for public images.- Always pin to a specific version tag like
redis:7.2in real projects. Usinglatestmeans the image can silently change on you. docker searchlets you find images without leaving the terminal. Add--filter is-official=trueto only see officially maintained images.- The
[OK]badge in search results means the image is official. No badge means it's community-contributed - check stars, pull count, and last updated date before trusting it. - If you're on an Apple Silicon Mac (M1/M2) and an image behaves strangely, try pulling with
--platform linux/amd64to force the correct architecture. - Pulling by digest (
@sha256:...) guarantees you always get the exact same image - useful when reproducibility matters most.
Frequently Asked Questions
Do I need to run docker pull before docker run?
No - docker run automatically pulls the image if it isn't already on your machine. docker pull is useful when you want to download an image ahead of time, or update a locally cached image to its newest version.
How do I see all the images I've already pulled?
Run docker images (or docker image ls). It lists every image stored locally along with its tag, ID, size, and when it was created.
Why does my pull say Already exists for some layers?
That's Docker reusing a cached layer from a previously pulled image. It's completely normal and actually a good thing - it means Docker is being efficient and not re-downloading data you already have.
What's the difference between a tag and a digest?
A tag (like redis:7.2) is a human-readable label that can be reassigned over time. A digest (like ubuntu@sha256:779...) is a cryptographic fingerprint that is permanently tied to one exact version of an image. Use digests when you need a guarantee that nothing will ever change.
Why do some image names have a slash and others don't?
Images without a slash (like nginx) are official images maintained by Docker or the software vendor. Images with a slash (like bitnami/postgresql) belong to a user or organization. The slash separates the namespace from the image name.
I'm on a Mac with Apple Silicon and the image isn't working - why?
Some images are only built for linux/amd64 (Intel architecture). Pull with --platform linux/amd64 to explicitly request that version, and Docker Desktop will run it through emulation automatically.