How to: Docker Remove Image


In order to remove an image or multiple images on your local Docker Desktop, you can make use of the Command Line (or Terminal on macOS) and make use of the docker rm command,

Example:

First let us do a docker images -a to see all the images that we have locally,

% docker images -a
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
alpine       latest    a6215f271958   2 months ago   5.29MB
alpine       edge      578ac1b1a970   3 months ago   5.27MB

As you can see I have two Linux Alpine images with tag latest and edge.


Docker remove image command

To docker remove an image, make use of the command, docker images rm <Image ID>

% docker image rm a6215f271958

Untagged: alpine:latest
Untagged: alpine@sha256:bc41182...95ee852a8d9730fc2ad
Deleted: sha256:a6215f271958c...8a6a26b4f6
Deleted: sha256:5d3e3...99f06a9772

Docker remove multiple images at once command

To remove multiple images at once, you can pass multiple Image IDs separated by a space along with the docker image rm command.

Example:
% docker image rm a6215f271958 578ac1b1a970
Docker Remove Image Command

Read more: https://docs.docker.com/engine/reference/commandline/image_rm/

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap