Home>Article>Operation and Maintenance> Can docker delete logs?
Docker can delete logs. Deletion method: 1. Use the "docker logs -f container id" command to view the container log, and use the cd command to enter the docker container directory; 2. Use the "cd container id() rm -rf container id.log" command to delete the file ending with ". file ending with "log"; 3. Use "docker restart container name or container id" to restart the file.
The operating environment of this tutorial: linux7.3 system, docker version 19.03, Dell G3 computer.
How to delete container logs with docker:
View container log command
docker logs -f 容器id
1. Enter the docker container directory
cd /var/lib/docker/containers/
View the id of the container and get the container id. The container id is the name of the container directory
docker ps -a
2. Enter the container and delete the file ending with .log which is the log file. Just delete it:
cd 容器id() rm -rf 容器id.log
##3. Restart the container
docker restart 容器名或者容器idThat’s it. Recommended learning: "
docker video tutorial"
The above is the detailed content of Can docker delete logs?. For more information, please follow other related articles on the PHP Chinese website!