Home >Operation and Maintenance >Docker >Can docker delete logs?

Can docker delete logs?

WBOY
WBOYOriginal
2022-08-17 16:42:4612941browse

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.

Can docker delete logs?

The operating environment of this tutorial: linux7.3 system, docker version 19.03, Dell G3 computer.

docker can delete logs

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/

Can docker delete logs?

View the id of the container and get the container id. The container id is the name of the container directory

docker ps -a

Can docker delete logs?

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

Can docker delete logs?

Can docker delete logs?

##3. Restart the container

docker restart 容器名或者容器id

Can docker delete logs?

That’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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn