Docker Images: Key Commands

Get a brief summary of the commands for managing Docker images covered in this chapter.

We'll cover the following

Summary of the Docker image commands

Let’s revise some of the commands we’ve used.

  • docker pull is the command to download images from remote registries. It defaults to Docker Hub but works with other registries. The docker pull alpine:latest command will pull the image tagged as latest from the alpine repository on Docker Hub.

  • docker images lists all of the images in our Docker host’s local repository (image cache). We can add the --digests flag to see the SHA256 hashes.

  • docker inspect gives us a wealth of image-related metadata in a nicely formatted view.

  • docker manifest inspect lets us inspect the manifest list of images stored in registries. The docker manifest inspect ghcr.io/regclient/regctl command will show the manifest list for the regctl image on the GitHub Container Registry (GHCR).

  • docker buildx is a Docker CLI plugin that works with Docker’s latest build engine features. We learned how to use the imagetools sub-command to query manifest-related data from images.

  • docker scout is a Docker CLI plugin that integrates with the Docker Scout backend to perform image vulnerability scanning. It scans images, provides reports on vulnerabilities, and even suggests remediation actions.

  • docker rmi is the command used to delete images. It removes all layer data stored on the local filesystem. However, images associated with containers in running (up) or stopped (exited) states cannot be deleted.

Get hands-on with 1300+ tech skills courses.