Use the Below command to remove all the old or stopped docker containers at once instead of using docker rm command.
docker container prune
This, in a single command, will remove any unwanted containers, networks, images (both dangling and unreferenced), and optionally, volumes.
docker system prune
Another method to remove the old containers is:
docker rm `docker ps --no-trunc -aq`