If you have Docker Desktop, you can also use that - see the “Clean up” section.

Resources

Delete container

$ docker rm CONTAINER_ID
$ docker rm CONTAINER_NAME

Add -f to force.

Add -v to delete volumes.

Get the ID from:

$ docker ps -a

Delete image

$ docker rmi IMAGE_ID

e.g.

$ docker rmi python:latest
$ docker rmi fd484f19954f

Get the details from:

$ docker images