Docker's VHDX takes up ~150GB after a few hours

Hi, I have a problem with the “docker_data.vhdx” file – it only takes a few hours for its size to increase to 150-160GB. Previously, vhdx compression helped, but this is only a temporary solution, because after a few hours the file returns to 150-160GB.

I have entered the following in the docker engine settings, but unfortunately it does not help:

{
  “builder”: {
    “gc”: {
      “defaultKeepStorage”: “20GB”,
      “enabled”: true
    }
  },
  “experimental”: false,
  “log-driver”: “local”,
  “log-opts”: {
    “max-file”: “3”,
    “max-size”: “10m”
  }
}

Does anyone know how to solve this problem and impose some kind of restriction on Docker so that it doesn’t take up so much disk space? Currently, I only have one container running, which takes up very little space, and its logs also have nothing to do with those 150-160GB.

On my system %LOCALAPPDATA%\Docker\wsl\disk\docker_data.vhdx is slightly under 50GB. I regularly build images and test them.

Did you do a docker system prune -a to get rid of all unused resources?

If the container logs to the file sytem, instead to STDOUT/STDERR, and uses the log level DEBUG or TRACE the logs can grow quiet fast.

Have you checked docker diff <container name> to see if unintended files are written into the container’s file system?