Skip to main content

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 COMMAND

Docker image ls

docker image ls → List docker images
Usage   : docker image ls [OPTIONS] [REPOSITORY[:TAG]]
Aliases : docker image list, docker images

Description:

  • 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 ID ensures it only uses the listed size once.
docker image ls
″”

Docker image pull

docker image pull → Download an image from a registry
Usage   : docker image pull [OPTIONS] NAME[:TAG|@DIGEST]
Aliases : docker pull

Description:

  • 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 pull
″”

Docker image push

docker image push → Upload an image to a registry
Usage   : docker image push [OPTIONS] NAME[:TAG]
Aliases : docker push

Description:

  • 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 push
″”

Docker image history

docker image history → Show the history of an image
Usage   : docker image history [OPTIONS] IMAGE
Aliases : docker history

Description:

  • 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 history
″”

Docker image inspect

docker image inspect → Display detailed information on one or more images
Usage   : docker image inspect [OPTIONS] IMAGE [IMAGE...]
Aliases : NA

Description:

  • 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 inspect
″”

Docker image tag

docker image tag → Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
Usage   : docker image tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Aliases : docker tag

Description:

  • 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 tag
″”

Docker image rm

docker image rm → Remove one or more images
Usage   : docker image rm [OPTIONS] IMAGE [IMAGE...]
Aliases : docker image, docker rmi

Description:

  • 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 ls to list all images on the host.
docker image rm
″”

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 save

Description:

  • 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 save
″”

Docker image load

docker image load → Load an image from a tar archive or STDIN
Usage   : docker image load [OPTIONS]
Aliases : docker load

Description:

  • This command loads an image or repository from a tar archive (even if compressed).
  • Works with files or STDIN and restores both the images and their tags.
docker image load
″”

Docker image import

docker image import → Import the contents from a tarball to create a filesystem image
Usage   : docker image import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
Aliases : docker import

Description:

  • You can load data from a URL or from STDIN (using -).
  • The URL can 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.
  • To import from a remote location, use a URI starting with http:// or https://.
docker image import
″”

Docker image prune

docker image prune → Remove unused images
Usage   : docker image prune [OPTIONS]
Aliases : NA

Description:

  • This command removes all dangling images (unused layers without tags).
  • Add -a to also remove all images not used by any container.
docker image prune
″”


Updated on Dec 10, 2025