Last active
June 24, 2022 08:32
-
-
Save lyovkin/1fe650a827eb375594e5ab806a866c5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Creating space by removing container logs | |
Similarly, the docker needs sufficient space in /var/lib/docker to write into it. So users get an error when the space is insufficient. Hence to create more space in the container, we remove large log files. | |
Our Support Engineers first list the log files. For this, we use the command, | |
du -d1 -h /var/lib/docker/containers | sort -h | |
The output of this command lists the container directories and log size. Hence, to clear the container log we use the command, | |
cat /dev/null > /var/lib/docker/containers/container_id/container_log_name | |
But, if there is no root access then we use the below command to prevent permission errors. | |
sudo sh -c "cat /dev/null > /var/lib/docker/containers/container_id/container_log_name" | |
Hence this resolves the error. | |
# sudo sh -c "truncate -s 0 /var/lib/docker/containers/*/*-json.log" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment