Forrest logo
back to the docker tool

docker:tldr:5f92a

docker: Remove an image without deleting untagged parents.
$ docker rmi --no-prune ${image}
try on your machine

The command "docker rmi --no-prune ${image}" is used to remove a Docker image from your local machine without pruning or removing any dependent images or containers.

Here's a breakdown of the command and its components:

  • "docker rmi": This is the Docker command used to remove Docker images. "rmi" stands for "remove image".

  • "--no-prune": This option is used to prevent the removal of any dependent images or containers. By default, when you remove an image, Docker automatically removes any dependent containers or child images that are no longer necessary. Using "--no-prune" ensures that these dependent resources are not deleted.

  • "${image}": This is a placeholder for the name or ID of the image you want to remove. You need to replace "${image}" with the actual name or ID of the image you want to delete. For example, if the image is named "myimage", the command would be "docker rmi --no-prune myimage".

So, the command "docker rmi --no-prune ${image}" allows you to delete a Docker image without removing any dependent containers or child images.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the docker tool