Fatskills
Practice. Master. Repeat.
Study Guide: Docker Docker Images and Containers docker pull docker images docker history
Source: https://www.fatskills.com/kubernetes/chapter/docker-docker-images-and-containers-docker-pull-docker-images-docker-history

Docker Docker Images and Containers docker pull docker images docker history

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~2 min read

1. Core Command / Concept

Pull and manage Docker images using the docker pull and docker images commands. docker images

2. Step-by-Step

  1. Check the current Docker images: docker images
    Output: List of images with their IDs, repository names, and tags.
  2. Pull the official Ubuntu image: docker pull ubuntu:latest
    Output: Download progress and image ID.
  3. List the images again: docker images
    Output: Updated list with the new image.
  4. Remove the pulled image: docker rmi ubuntu:latest
    Output: Confirmation of image deletion.
  5. ⚠️ Delete all stopped containers: docker container prune
    Output: Confirmation of container deletion.

3. Real Commands with Examples


Example 1: Pull a Specific Image Version

Purpose: Pull a specific version of the Ubuntu image.
Command: docker pull ubuntu:18.04 Flags: ubuntu is the repository name, 18.04 is the tag.

Example 2: Pull an Image with a Specific Architecture

Purpose: Pull the official Ubuntu image for arm64 architecture.
Command: docker pull ubuntu:latest-arm64 Flags: ubuntu is the repository name, latest-arm64 is the tag.

Example 3: Pull an Image with a Specific Digest

Purpose: Pull the official Ubuntu image with a specific digest.
Command: docker pull ubuntu@sha256:1234567890abcdef Flags: ubuntu is the repository name, sha256:1234567890abcdef is the digest.

4. Common Errors


Error 1: Image Not Found

Error message: Error: No such image: ubuntu:latest Why it happens: The image does not exist in the Docker registry.
Fix: docker pull ubuntu:latest (try a different tag or repository).

Error 2: Image Pull Failed

Error message: Error: Error pulling image: Get https://...: dial tcp: i/o timeout Why it happens: Network connectivity issue or Docker registry unavailability.
Fix: docker pull ubuntu:latest (try again after resolving the issue).

Error 3: Image Deletion Failed

Error message: Error: No such image: ubuntu:latest Why it happens: The image does not exist in the Docker registry.
Fix: docker rmi -f ubuntu:latest (force deletion).

5. Quick Checks


Scenario 1: Check if an Image Exists

Situation: You want to check if the official Ubuntu image exists.
Command: docker images ubuntu:latest Correct response: List of images with the Ubuntu repository name.

Scenario 2: Check Image Pull Progress

Situation: You want to check the progress of the image pull.
Command: docker ps -a Correct response: List of containers with the pulling image.

Scenario 3: Check Image Digest

Situation: You want to check the digest of the pulled image.
Command: docker inspect ubuntu:latest Correct response: Image metadata with the digest.

6. Last-Minute Reference

  • docker images lists all images.
  • docker pull downloads an image.
  • docker rmi removes an image.
  • docker container prune deletes all stopped containers.
  • docker inspect displays image metadata.
  • docker ps -a lists all containers.
  • docker version displays Docker version information.
  • ⚠️ Use docker rmi -f to force image deletion.
  • ⚠️ Use docker container prune -f to force container deletion.
  • ⚠️ Use docker system prune -f to force system cleanup.


ADVERTISEMENT