How to safely remove docker host log?

I’m using Windows Docker Destop with WSL2 backend.
Currently, I’m checking the storage usage and found that my docker host log is as large as 10GB. The path is: AppData\Local\Docker\log\host*. I couldn’t find a delete host logs command anywhere. Is it safe to manually delete the logs or how to safely delete the host logs?

PS: Already tried factory reset / prune / clean / purge. All of them are for containers and not working for host logs.

Best regards,

Those are just files as far as I know in the “host” folder. And it keeps old logs as well. I turned off my Windows, but on macOS I see this:

-rw-r--r--@   1 ta  staff   641319 Apr 20 21:14 Docker.log
-rw-r--r--    1 ta  staff  1047765 Nov 23 23:29 Docker.log.0
-rw-r--r--    1 ta  staff  1048567 Nov 23 00:07 Docker.log.1
-rw-r--r--    1 ta  staff  1048436 Nov 22 23:25 Docker.log.2
-rw-r--r--    1 ta  staff  1048027 Nov 22 22:49 Docker.log.3
-rw-r--r--    1 ta  staff  1048292 Nov 22 22:13 Docker.log.4
-rw-r--r--    1 ta  staff  1048192 Nov 22 21:38 Docker.log.5
-rw-r--r--    1 ta  staff  1048402 Nov 22 21:03 Docker.log.6
-rw-r--r--    1 ta  staff  1047628 Nov 22 20:27 Docker.log.7
-rw-r--r--    1 ta  staff  1048520 Nov 22 20:09 Docker.log.8

The latest where there is no number at the end, could be kept unless something happaned and that is what became huge. There are other similar files but the method is the same. I would keep the latest logs and remove the old logs. Or you can remove only the large file if you find it.

Make sure you stop Docker Desktop before removing log files, but the old logs are probably not open, only the latest files if any.

Just to be safe, you could copy the folder as host-copy and delete files from host. If anything goes wrong, you could restore the files. I don’t think deleting all log files would cause any trouble, but the worst case is that you need to remove the whole Docker folder and reinstall Docker Desktop.

If you choose that, check the list of folders in the documentation:

You can find the folders to delete at the end of the page.

1 Like