Removing Unwanted Docker-Compose Containers


Applicable to any "s" version of software running in the Docker Container environment.


Having too many Docker Compose containers and files on your system can make things rather confusing if many of them serve no purpose. Just like in many other areas, it is best to keep things neat and throw away what you don't need. Here we will discuss the steps involved in removing excess Docker Compose material from your machine.

WARNING: Be sure to read this article in its entirety before making changes to your computer's file system or docker container environment. This procedure is permanent and can not be undone. If you are not sure which files or containers to remove from your system, contact us first.

Here's what to do:

  1. Stop any containers you don't need
  2. Run the command below and observe the output:
sudo docker ps -a
  1. Remove unwanted containers

You can remove individual containers by using the following command (replacing the "xx" with the container name or ID from the ps -a output text).

sudo docker rm xx

You can also remove all stopped containers by using this command:

sudo docker container prune
  1. Remove docker-compose data from your file system
  • Navigate to /opt/telos and run the command ls -a
  • Determine the directories that are associated with the containers you just removed
BEWARE: The following changes can not be undone. If you do not know which files or containers to remove, please contact us first.
  • Run the sudo rm -r xx command (replacing "xx" with the directory name you want to delete)
  • Repeat until all unwanted directories are removed.

Let us know how we can help

If you have further questions on this topic or have ideas about improving this document, please contact us.

How did we do?