Hi all. So I’m running one container. Want to see the size of the log before trancating to free up disk space.
But I can’t find what command I type in windows CMD/powershell to see the log size and space its taking up. I googled it and tried:
sudo du -h $(docker inspect --format=‘{{.LogPath}}’ $(docker ps -qa))
But get a message saying sudo is not a term recognised. So what do I type in CMD to see how much space the log has taken up so far?
Are you running Windows containers or Linux containers on Windows? If you don’t want to automate it, you could just run the inspect command and if it shows a Windows path, just go there in the file browser. If it is a Linux path, than you run Linux containers and everything is inside a virtual machine.
I’m running windows container on windows 11. Looking to know what command to type in CMD to see the the amount of space the log file has taken up so far.
What did the inspect command return? If it returned a valid Windows path then the question is just about Windows command line for which I would need to google probably as much as you
sudo is a command that tells your machine to run what follows it using the Root user’s permissions
It seems not to be recognized, try to omit it and just run du -h ...
It is a Linux path so you run Linu containers not Windows containers as you wrote before. If you are on Windows and run Docker Desktop, the container is in the virtual machine. It also means it is harder to truncate the logs and I’m not even sure you should as it could cause problems. You could just delete the container which deletes the logs as well and recreate the container. Since data should be on volumes or bind mounted, deleting the container should not cause data loss.