Docker Image Commands
These commands let you manage images in Docker - build new ones, list existing ones, inspect details, remove unused images, and pull or push images to registries. They’re the toolbox for creating and handling the building blocks of your containers.
docker image → Manage images
docker image ls → List images
docker image pull → Download an image from a registry
docker image push → Upload an image to a registry
docker image history → Show the history of an image
docker image inspect → Display detailed information on one or more images
docker image tag → Give a name for an image
docker image rm → Remove one or more images
docker image save → Save one or more images to a tar archive
docker image load → Load an image from a tar archive
docker image import → Import the contents from a tarball to create a filesystem image
docker image prune → Remove unused images
Docker Image
docker image → Manage Images Usage : docker image COMMANDDocker image ls
docker image ls → List docker imagesUsage : docker image ls [OPTIONS] [REPOSITORY[:TAG]]
Aliases : docker image list, docker imagesDescription:
- Shows top-level images with their repository, tags, and total size.
- Images are built in layers that boost reusability, save disk space, and speed up builds but these intermediate layers aren’t shown by default.
SIZE= combined space of the image plus all its parent layers (same as the tar file size if you docker save).- If an image has multiple names/tags, it may appear more than once, but the
IMAGE IDensures it only uses the listed size once.

Docker image pull
docker image pull → Download an image from a registryUsage : docker image pull [OPTIONS] NAME[:TAG|@DIGEST]
Aliases : docker pullDescription:
- Most images start from a base image on Docker Hub.
- Docker Hub has tons of ready-made images you can pull and use with docker pull.
- If you’re behind a proxy (like in offices), configure Docker’s proxy settings before connecting.
- By default, Docker downloads 3 layers at once. On slow internet, this can cause timeouts - tune it with
--max-concurrent-downloads.

Docker image push
docker image push → Upload an image to a registryUsage : docker image push [OPTIONS] NAME[:TAG]
Aliases : docker pushDescription:
- Shares your image to Docker Hub or a private registry.
- Image names and tags must follow the docker tag rules.
- Stopping the process (like pressing
CTRL‑C) cancels the push. - Shows a progress bar with uncompressed size, but data is actually compressed before upload.
- Login credentials are handled with docker login.
- By default, Docker uploads 5 layers at once. On slow internet, adjust with
--max-concurrent-uploads.

Docker image history
docker image history → Show the history of an imageUsage : docker image history [OPTIONS] IMAGE
Aliases : docker historyDescription:
- This command shows the step‑by‑step history of how an image was built. Each layer is listed with details like the command used, size, and when it was created to help you tracing the image’s construction.

Docker image inspect
docker image inspect → Display detailed information on one or more imagesUsage : docker image inspect [OPTIONS] IMAGE [IMAGE...]
Aliases : NADescription:
- This command shows detailed information about one or more images like configuration, layers, size, and metadata. It’s the deep dive tool for understanding exactly how an image is built and stored.

Docker image tag
docker image tag → Create a tag TARGET_IMAGE that refers to SOURCE_IMAGEUsage : docker image tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Aliases : docker tagDescription:
- A Docker image reference tells Docker where an image lives and which version it is. It’s made of:
HOST[:PORT]→ Registry location (defaults to Docker Hub if skipped). - Format:
[HOST[:PORT]/]NAMESPACE/REPOSITORY[:TAG] NAMESPACE/REPOSITORY→ User/Org (optional) + required repository name. If no namespace, defaults to library (official images).TAG→ Version or variant (defaults to latest if not given).

Docker image rm
docker image rm → Remove one or more imagesUsage : docker image rm [OPTIONS] IMAGE [IMAGE...]
Aliases : docker image, docker rmiDescription:
- Removes one or more images from the host machine.
- If an image has multiple tags, removing by tag only deletes that tag and if the tag is the only one, the image itself is removed too.
- Does not delete images from a registry.
- You can’t remove an image used by a running container unless you add
-f. - Use docker
image lsto list all images on the host.

Docker image save
docker image save → Save one or more images to a tar archive (streamed to STDOUT by default)Usage : docker image save [OPTIONS] IMAGE [IMAGE...]
Aliases : docker saveDescription:
- This command creates a tar file of an image (or repository) and sends it to the output stream.
- Includes all parent layers and contains all tags and versions, or just the ones you specify with
repo:tag.

Docker image load
docker image load → Load an image from a tar archive or STDINUsage : docker image load [OPTIONS]
Aliases : docker loadDescription:
- This command loads an image or repository from a tar archive (even if compressed).
- Works with files or
STDINand restores both the images and their tags.

Docker image import
docker image import → Import the contents from a tarball to create a filesystem imageUsage : docker image import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
Aliases : docker importDescription:
- You can load data from a
URLor fromSTDIN(using-). - The
URLcan point to:- An archive (
.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) → Docker untars it into the container’s root /. - An individual file → must give the full path on the host.
- An archive (
- To import from a remote location, use a
URIstarting withhttp://orhttps://.

Docker image prune
docker image prune → Remove unused imagesUsage : docker image prune [OPTIONS]
Aliases : NADescription:
- This command removes all dangling images (unused layers without tags).
- Add
-ato also remove all images not used by any container.

Follow for Engineering and Tech - Tips, Tricks, Roadmaps, Resources, Networking, Motivation, Guidance, and Cool Stuff ♥
