Force Remove Docker Container
Even when a container is in operation, it can be forcefully removed by using the -f or –force option with the docker rm command. If you wish to forcefully remove a running container, you must use the -f option since Docker does not enable this by default.
docker rm -f CONTAINER_ID_or_NAME
You can see that I attempted to remove the Docker container both with and without the -f option in the following image.
What Is Docker rm Command ?
“docker rm” is used to remove one or more Docker containers that are running on the Docker host. A Docker container uses up system resources like CPU, memory, and disk space when it is running. To free up such resources, you may choose to uninstall a container after using it for a while.
docker rm [OPTIONS] CONTAINER [CONTAINER…]
- OPTIONS: Various options can be used with the docker rm command to modify its behavior.
- CONTAINER: The name or ID of the Docker container(s) to be removed.