How to remove stopped and unused container in Docker

How to remove stopped and unused container in Docker.

Date: 06-02-2021

Step 01: List all Docker containers using the command.
# docker ps -a
OR
# docker container ls -a

Step 02: Enter the below command to stop the specific container.
# docker container stop [Container_id]
Note: [Container_id] – Numeric ID of the container from your list.
Use below command to stop all running container.
# docker container stop $(docker container ls -a)

Step 03: Use the below command to remove a stopped container.
# docker container rm [Container_id]
To remove all stopped and unused containers:
# docker container rm $(docker container ls -a)
OR
# docker system prune

Thank you!

admin

Our team has expertise across software and web development, WordPress, e-commerce, mobile applications, UI/UX, cloud and infrastructure, DevOps, CI/CD, API integration, security, testing, automation, and technical support. The team also works with AI-based software solutions, LLMs, AI workflows, AI agents, and intelligent application development to help businesses automate processes and build smarter digital solutions. We focus on developing, deploying, maintaining, and optimising secure, scalable, and reliable technology solutions while helping businesses adopt modern technologies and drive digital transformation.

Leave a Reply

Scroll to Top