Search code examples
linuxbashdockershellcontainers

How to free up space used by docker containers without docker restart?


I have a project with docker containers that make a huge logs at /var/lib/docker/containers when /var/lib/docker/containers/containerid.json.log is deleted, the space still not free. for some reasons docker-deamon should not be restarted. if docker-daemon restart or if server rebooted the problem will be solved but I can't do it and the container should be online every time. what should I do?


Solution

  • For a oneshot cleanup you should use:

    sudo truncate -s 0 /var/lib/docker/containers/containerid.json.log