---
title: "The docker image Command Family: A Practical Reference"
date: "2026-11-18T17:30:00+07:00"
description: "Comprehensive reference guide covering the docker image CLI command family: ls, build, pull, push, tag, inspect, rm, prune, history, save, and load."
author: "AI Assistant"
image: "https://blog.redlinesoft.net/images/post/docker-image-command-family-reference.jpg"
alt: "CLI cheatsheet diagram illustrating subcommands under the docker image management umbrella"
tags: ['docker', 'cli', 'cheatsheet', 'devops']
---

In modern Docker CLI syntax, commands are organized into explicit management command families (e.g. `docker container`, `docker network`, `docker volume`, `docker image`). While legacy shortcuts like `docker rmi` or `docker images` still exist for backward compatibility, using the formal `docker image <subcommand>` family provides clearer, more consistent syntax.

In this practical reference guide, we will catalog the full `docker image` management command family, providing real-world examples and common flag usage for developers and DevOps engineers.

## `docker image` Subcommand Overview

```text
+-----------------------------------------------------------------------------------+
|                            docker image Command Family                            |
+-----------------------------------------------------------------------------------+
|  docker image build    : Build image from Dockerfile                              |
|  docker image ls       : List locally stored images                               |
|  docker image pull     : Fetch image manifest & layers from registry              |
|  docker image push     : Upload image manifest & layers to registry               |
|  docker image tag      : Assign a new repository tag to an image ID               |
|  docker image inspect  : Read low-level JSON configuration metadata               |
|  docker image history  : Display layer lineage & build commands                   |
|  docker image rm       : Remove local images or untag references                  |
|  docker image prune    : Clean up dangling or unused images                       |
|  docker image save     : Export images to tar archive                             |
|  docker image load     : Import images from tar archive                           |
+-----------------------------------------------------------------------------------+
```

---

## Command Reference & Examples

### 1. `docker image build`
Builds a container image from a Dockerfile and context path.

```bash
# Basic build with tag
docker image build -t myapp:v1.0.0 .

# Build passing build args without cache
docker image build --no-cache --build-arg VERSION=1.2.0 -t myapp:v1.2.0 .
```

### 2. `docker image ls`
Lists locally cached images.

```bash
# Basic list
docker image ls

# Show full SHA-256 digests
docker image ls --digests

# Filter for dangling (untagged) images
docker image ls --filter "dangling=true"

# Custom table output format
docker image ls --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
```

### 3. `docker image pull`
Downloads an image manifest and layers from a remote OCI registry.

```bash
# Pull specific version tag
docker image pull python:3.11-alpine

# Pull target platform variant
docker image pull --platform linux/arm64 ubuntu:22.04

# Pull by immutable SHA-256 digest
docker image pull redis@sha256:590c29f656722dca8f176b63f...
```

### 4. `docker image push`
Uploads local image layers and manifest to a registry.

```bash
# Push single tagged image
docker image push myregistry.com/team/myapp:v1.0.0

# Push all tags for a repository
docker image push --all-tags myregistry.com/team/myapp
```

### 5. `docker image tag`
Creates a new tag pointer pointing to an existing Image ID or reference.

```bash
# Create release tag from local build
docker image tag myapp:latest myregistry.com/team/myapp:v1.0.0
```

### 6. `docker image inspect`
Returns detailed low-level JSON metadata for one or more images.

```bash
# Full JSON inspect
docker image inspect nginx:1.25

# Format specific field using Go template (Extract OS/Architecture)
docker image inspect --format='{{.Os}}/{{.Architecture}}' nginx:1.25
```

### 7. `docker image history`
Displays the ordered layer history and Dockerfile commands used to build an image.

```bash
# Basic history
docker image history nginx:1.25

# Show non-truncated full build commands
docker image history --no-trunc nginx:1.25
```

### 8. `docker image rm`
Removes one or more local images by tag or ID.

```bash
# Remove by tag
docker image rm myapp:v1.0.0

# Force remove (untags referenced images)
docker image rm -f 92b11f4d1571
```

### 9. `docker image prune`
Deletes unused container images to free disk space.

```bash
# Remove only dangling (<none>:<none>) images
docker image prune -f

# Remove ALL unused images not referenced by any container
docker image prune -a -f

# Remove images older than 48 hours
docker image prune -a --filter "until=48h" -f
```

### 10. `docker image save` & `docker image load`
Exports and imports images offline via tar archives.

```bash
# Export image to compressed tar
docker image save myapp:v1.0.0 | gzip > myapp-v1.0.0.tar.gz

# Import image archive
docker image load -i myapp-v1.0.0.tar.gz
```

---

## Legacy Shortcuts Cheat Sheet

| Modern Command | Legacy Alias |
| :--- | :--- |
| `docker image ls` | `docker images` |
| `docker image rm` | `docker rmi` |
| `docker image build` | `docker build` |
| `docker image pull` | `docker pull` |
| `docker image push` | `docker push` |

## Summary

Using the structured `docker image` management command family keeps scripts readable and aligns with modern Docker CLI standards.
