How it works...
This recipe is no different from what we saw in the previous recipes. As usual, the names of the Remove-Container and Remove-ContainerImage cmdlets are self-explanatory.
While working with Docker, many containers may get created and many images may be downloaded. Removing images helps us save disk space.
As Docker containers are the layer that's built on top of the Docker images, it is required that you stop the containers before removing the Docker images to avoid potential inconsistency in the system state.
We can also remove the image without stopping the containers by using the -Force inline argument on the Remove-ContainerImage cmdlet. However, we recommend against doing this because the -Force option is not a recommended ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access