Languages
[Edit]
EN

Docker - remove more than 1 docker image in single line

3 points
Created by:
troya
692

In this article we would like to show you how to remove more then 1 docker image in single command.

Quick solution:

# remove 2 images in single line
$ docker rmi IMAGE_ID_1 && docker rmi IMAGE_ID_2

Practical example:

# list all docker images
$ docker images
REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
mysql                    latest              e1d7dc9731da        2 weeks ago         544MB
docker/getting-started   latest              1f32459ef038        2 months ago        26.8MB
openjdk                  8-jdk-alpine        a3562aa0b991        16 months ago       105MB

# remove 2 images in single line
$ docker rmi e1d7dc9731da && docker rmi 1f32459ef038

Explanation:

On above screenshot we can see that we executred 2 commands docker rmi IMAGE_ID in a single line with && operator.

After removal the docker images in this case will look like this:

# list all docker images
$ docker images
REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
openjdk                  8-jdk-alpine        a3562aa0b991        16 months ago       105MB

 

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Docker - useful wiki posts

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join