I had a very long running (and verbose) container job on Google's Container-Optimized OS (COS) that eventually generated enough logs to fill the disk.
To my knowledge there isn't a way to rotate / limit log file size while using COS.
Inspecting the running container, it appears that it writes an ever-growing file to /var/lib/docker/containers/
(mounted on the stateful partition) and that HostConfig.LogConfig.Config
is empty.
I ended up having to SSH in and manually delete the multi-gigabyte log file to make the VM operational again.
I read through https://cloud.google.com/compute/docs/containers/configuring-options-to-run-containers and as far as I can tell there isn't a way to (say) pass --log-opt max-size=XX
as per the Docker documentation:
https://docs.docker.com/config/containers/logging/json-file/
Is there some way to pass that flag? Failing that, are there recommendations on how to rotate logs / limit log size / avoid hitting this problem?