Categories
Business Central Docker Dynamics NAV HOW TO Microsoft PowerShell

HOW TO remove docker dangling and unused images

Let us extend the concept of Spring Cleaning to our computers, virtual machines and servers where we are using Docker.

I was starting writing some PowerShell script from the list of the docker images

PS C:\> docker images

and thinking which filters to apply when I thought that maybe docker contains already a command that does some good cleanup.

Here the result of my research, we can use docker image prune, in my case I added also the parameters -a to remove all unused images (all images without at least one container associated to them) and -f that stands for Force to do not prompt for confirmation:

PS C:\> docker image prune -a -f

Note: every docker image related to Microsoft Dynamics NAV or Microsoft Dynamics 365 Business Central takes usually 10-20 GB of space.

If you use navcontainerhelper for the creation of the Docker containers I suggest you to have a look also of the content of the folder under the following path:

C:\ProgramData\NavContainerHelper

You could find old database backup or source file objects downloaded that could be deleted as well.

Did my HOW TO help you? Leave a reply.

Categories
Docker Microsoft PowerShell

docker : Error response from daemon: removal of container ### is already in progress

You run one of the following PowerShell commands to remove a container

Remove-NavContainer ###

or

docker rm ###

but you receive the following error message:

docker : Error response from daemon: removal of container ### is already in progress

with the result that you are unable to stop, kill or remove the Docker container. Even a restart does not fix this issue.

Solution 1:

  1. Run the PowerShell command net stop docker to stop docker-engine (Note all containers will stop)
  2. Delete the folder in C:\Programdata\docker\containers whose name starts with the ID from the error message (###)
  3. Run the PowerShell command net start docker to start docker-engine

Solution 2:

Restart the machine will restart docker-engine if it the service is set up to start Automatically.

Did my solution solve your problem? Leave a reply.