EN
Docker - remove more than 1 docker image in single line
3
points
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