Working with Docker Images: Search, Pull, Inspect, and Manage

An image is a packaged, executable artifact containing the application code, libraries, environment variables, and configuration files needed to run a container.

Searching for Images

The docker search command queries Docker Hub for available images.

docker search [OPTIONS] TERM

Useful options:

  • -f, --filter apply a filter condition
  • --format customize output using Go templates
  • --limit set the maximum number of results (default 25)
  • --no-trunc disable output truncation

Example: search for images contianing "centos" and restrict results to official ones.

docker search -f is-official=true centos

Pulling Images

Download images from a registry with docker pull.

docker pull [OPTIONS] NAME[:TAG|@DIGEST]
  • -a, --all-tags downloads every tag of the given image.
# latest Ubuntu image
docker pull ubuntu

# specific version
docker pull ubuntu:16.04

Listing Local Images

Display locally stored images using docker images.

docker images
# filter by name
docker images ubuntu
# wildcard matching
docker images cent*
# specify tag with a pattern
docker images ubun*:16.04

Removing Images

Delete one or more images from the local store.

docker rmi [OPTIONS] IMAGE [IMAGE...]
# or
docker image rm [OPTIONS] IMAGE [IMAGE...]
  • -f, --force force removal when image is referenced.

Delete by repository name:

docker rmi ubuntu

Delete by ID (a unique prefix is sufficient):

docker rmi 9f3

Exporting and Importing Images

Backing Up with docker save

Save images into a tar archive.

docker save [OPTIONS] IMAGE [IMAGE...]
  • -o, --output specify the output file (default stdout).
docker save ubuntu:16.04 94e814 -o linux.tar

Loading an Archive with docker load

Import images from a tar file created by save.

docker load [OPTIONS]
  • -i, --input read from a file instead of stdin
  • -q, --quiet suppress progress information
docker load -i linux.tar

When saving by ID without tags, the loaded image may appear with <none> for name and tag. Prefer saving by repository:tag.

Renaming Images

Create a new repository reference (and tag) to an existing image.

docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
docker tag 94e ubuntu:18.04

Inspectinng Image Details

View low-level metadata with docker image inspect (or docker inspect).

docker image inspect [OPTIONS] IMAGE [IMAGE...]
  • -f, --format output a specific field using Go templates.
# full JSON details
docker image inspect ubuntu:18.04

# extract the image ID
docker image inspect -f "{{ .Id }}" ubuntu:18.04

# storage driver data
docker image inspect -f "{{ .GraphDriver.Data }}" ubuntu:18.04

Viewing the Layer History

Show the layers and their creation commands with docker history.

docker history [OPTIONS] IMAGE
  • -H, --human print sizes and dates in human-readable form (default true)
  • -q, --quiet display only IDs
  • --no-trunc show full output without truncation
docker history ubuntu:18.04

Tags: docker container Image Management devops CLI

Posted on Sat, 04 Jul 2026 18:03:54 +0000 by asifkamalzahid