Sometimes we need to remove all containers, that were made on the same image. If those containers are many, it will be a good reason to try getting them deleted with single command.

For example, this command can look like:

docker rm $(docker ps -a -q --filter "ancestor=DOCKER_IMAGE_NAME")

DOCKER_IMAGE_NAME - name of the image, containers are based on.

Note: this command kills every container no matter it is up or down.

No comments yet