Removing a Docker container can easily be done by following these steps:
docker ps
command with the -a
flag to locate the name or ID of the container(s) you want to remove:docker ps -a
<ID>
by the ID of the container that you want to remove:docker rm <ID>
docker rm <ID1> <ID2>
You can also automatically remove a container when it exits. This is useful if you know, while creating a container, that you will not need it afterward. The following command will run the container and automatically remove it upon exit:
docker run --rm image_name
Free Resources