Truncate Logs Docker Container
Truncate Logs Docker Container
1./ Lệnh Truncate Logs
truncate -s 0 /var/lib/docker/containers/*/*-json.log
hoặc
truncate -s 0 /opt/docker/containers/*/*-json.log
hoặc
sudo sh -c "truncate -s 0 /var/lib/docker/containers/*/*-json.log"
2./ Xóa toàn bộ Docker đang tồn tại
docker rm -vf $(docker ps -a -q)
-v: Remove all associated volumes
-f: Forces the removal. Like, if any containers is running, you need -f to remove them.
3./ Xóa toàn bộ Images đang tồn tại
docker rmi -f $(docker images -a -q)
-a: for all containers, even not running, (or images)
-q: to remove all the details other than the ID of containers (or images)
Tham khảo
https://stackoverflow.com/questions/42510002/how-to-clear-the-logs-properly-for-a-docker-container
#
https://stackoverflow.com/questions/38060279/deleting-all-docker-images-and-containers