Removing unused/obsolete containers is also part of a normal Docker workflow. In this recipe, we will discuss the process of removing Docker containers and Docker images.
Removing containers and container images
How to do it...
You should have the PowerShell session open and have loaded the Docker module into the session by now.
Now, let's remove some containers and images. You can use the conditional construct to list specific containers, or we can remove all of the containers and images to start with a clean slate:
- Get the list of all available containers:
PS> Get-Container
- Stop all of the running containers:
PS> Get-Container | where-object {$_.Status -match 'up'} | Stop-Container
If you would...