21

According to Docker documentations, docker image rm "Remove one or more images" [1]. docker rmi has a same description [2], but then it goes on to say "Removes (and un-tags) one or more images from the host node."

Do docker image rm IMAGE and docker rmi IMAGE have an identical effect under any scenario? IMAGE is ID of the particular image that is to be removed.

Dashrath Mundkar
  • 7,956
  • 2
  • 28
  • 42
Reveille
  • 4,359
  • 3
  • 23
  • 46

3 Answers3

28

The man page for docker rmi specifies that docker rmi is an alias for docker image rm. I suppose the documentation from docker is a little bit inconsistent in that regard. They write all the details for docker rmi while the documentation for docker image rm is lackluster.

octagon_octopus
  • 1,194
  • 7
  • 10
  • 2
    The `docker container ...` and `docker image ...` commands are newer, but there's a lot of older tutorials/scripts/experience that's used to using the older unqualified `docker run` and `docker rmi` type commands. – David Maze Jul 22 '20 at 14:57
1

It looks like docker rm is for containers and docker rmi is for images.

PS C:\Users\3des> docker rm httpd --force
Error: No such container: httpd
PS C:\Users\3des> docker rm httpd
Error: No such container: httpd
______________________________________________
PS C:\Users\3des> docker rmi httpd --force
Untagged: httpd:latest
Untagged: httpd@sha256:2fab99fb3b1c7ddfa99d7dc55de8dad0a62dbe3e7c605d78ecbdf2c6c49fd636
``


  
Greenonline
  • 1,330
  • 8
  • 23
  • 31
-2

1). The docker image rm command "Remove one or more containers" not container image. to check for container and its ID "docker ps -a" command

2). However, the docker rmi command means rm = remove i = image. it is used to removing docker images. remembers that containers are created from images. the "docker images or docker image ls" shows images, repository, TAG, and image ID. docker rmi <image_ID> to remove image. NOTE even when it is possible to create a new image from the existing image using the "docker commit" command, such image will come it its unique image id.

Emmanuel
  • 1
  • 1
  • 5
    This is false. you are confusing `docker image rm` with `docker rm`. The description of `docker image rm` [from the docs](https://docs.docker.com/engine/reference/commandline/image_rm/) confirms that it's `Remove one or more images`. – octagon_octopus Sep 24 '21 at 19:24