I am running a container on a VM. My container is writing logs by default to /var/lib/docker/containers/CONTAINER_ID/CONTAINER_ID-json.log file until the disk is full.
Pass log options while running a container. An example will be as follows
sudo docker run -ti --name visruth-cv-container --log-opt max-size=5m --log-opt max-file=10 ubuntu /bin/bash
where --log-opt max-size=5m
specifies the maximum log file size to be 5MB and --log-opt max-file=10
specifies the maximum number of files for rotation.