![]() ![]() Volumes are used for multiple containers and it is very likely there will be a number of either unused or stopped volume files. When you’re done, the container will be deleted automatically. Here’s an example on how to remove such container: docker run -rm CONTAINER_ID If you want to remove a container once you’re done working with it, you start one by adding a –rm flag. To limit the removal of containers that stopped, for example, according to the time frame, you can use the following command: docker container prune -filter "until=24h" In order to view the list of what containers will be deleted using the beforementioned command, use the –filter flag: docker container ls -a -filter status=created -filter status=exited Take note that this will remove all stopped containers. To remove all the containers that stopped in the application, follow this command: docker container prune If you want to remove a specific container, enter the CONTAINER ID as shown in this example: docker container rm CONTAINER_ID Similarly to before, in order to see the list of all Docker containers, you will need to run this command: docker container ls -a In order to force executing any “remove” command at any given time, use the -f or –force flag.
0 Comments
Leave a Reply. |