To stop and remove everything related to a Docker Compose setup (containers, networks, volumes, images, etc.), you can use the following command:
docker-compose down --rmi all --volumes --remove-orphans
Explanation:
-
down: Stops and removes the containers, networks, and other resources created bydocker-compose up. -
--rmi all: Removes all images used by any service. -
--volumes: Removes all named volumes declared in thevolumessection of thedocker-compose.ymlfile. -
--remove-orphans: Removes any containers not defined in thedocker-compose.ymlfile but are part of the same project.
This command will completely clean up everything related to the Docker Compose project.
Top comments (1)
Absolutely incredible! 😻.