Outline
Cleaning Things Up
To delete individual containers use the command docker container rm [ID-OF-CONTAINER]
.
To list only the IDs for all containers use the command docker container ls -aq
. The -aq
flag specifies that all container IDs should be listed.
To delete all containers run the command docker container rm $(docker container ls -aq)
. Note that this is the bash command. If you are using a different shell your command may be slightly different.
Run docker container ls -a
to verify that all containers are deleted.
Similarly you can list images using docker image ls
and delete individual images using the command docker image rm [NAME-OF-IMAGE]
.
Docker prevents you from deleting images and containers that are still in use.