How to clear the logs properly for a Docker container?

前端 未结 15 2525
谎友^
谎友^ 2020-12-12 09:00

I use docker logs [container-name] to see the logs of a specific container.

Is there an elegant way to clear these logs?

15条回答
  •  旧时难觅i
    2020-12-12 09:33

    As a root user, try to run the following:

    >  /var/lib/docker/containers/*/*-json.log
    

    or

    cat /dev/null > /var/lib/docker/containers/*/*-json.log
    

    or

    echo "" > /var/lib/docker/containers/*/*-json.log
    

提交回复
热议问题