Skip to content

Cleaning up: rm, rmi and prune

Select an icon to see what it is.

Step 2 of 6

rm deletes a container, rmi an image

docker rm sends DELETE /containers/{id}, and the container must be stopped unless you add -f. docker rmi sends DELETE /images/{name}. An image that a container uses cannot be removed unless you force it.

$ docker rm -f sleeper && docker rmi nginx

DELETE /v1.45/containers/<id>

204 No Content
409 Conflict if the container is running and force is not set