Expected behavior
Docker run reliably completes successfully, removing it after completion.
Actual behavior
The docker run appears to execute the command it was supposed to, however sometimes at the end it then gives this error:
Error waiting for container: container 43b9dd9ae8c8d1fcd15b3297963f212caa11834d710e8946f49a370afaedb582: driver “windowsfilter” failed to remove root filesystem: failed to detach VHD: The device is not ready.: rename C:\ProgramData\docker\windowsfilter\43b9dd9ae8c8d1fcd15b3297963f212caa11834d710e8946f49a370afaedb582 C:\ProgramData\docker\windowsfilter\43b9dd9ae8c8d1fcd15b3297963f212caa11834d710e8946f49a370afaedb582-removing: Access is denied.
Information
We are recently looking at updating our CI/build process to build within Docker containers rather than directly on the host. As a result, this build process involves calling a docker run command that looks something like:
docker run --rm …
The command is generally a call to msbuild. Image is based on the framework/sdk:4.8 (additions made to add additional VS build tools workloads).
Sometimes, when this is called, we get the above error. Out of like 20 calls, maybe 5 will fail. Rerunning the failed jobs will eventually result in successful runs. I don’t know whether msbuild is actually important to the process or not - that’s just the use case we are running in to.
Steps to reproduce the behavior
- Execute msbuild via a docker run with the “–rm” flag specified to clean up the container after execution.
- Observe that sometimes it fails with the error (after running everything it was supposed to).