Created
November 16, 2019 07:47
-
-
Save cygmris/4ae53c155bbef17e705d750cf7ae60fa to your computer and use it in GitHub Desktop.
docker-clear-log.sh
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
#!/bin/bash -e | |
if [[ -z $1 ]]; then | |
echo "No container specified" | |
exit 1 | |
fi | |
if [[ "$(docker ps -aq -f name=^/${1}$ 2> /dev/null)" == "" ]]; then | |
echo "Container \"$1\" does not exist, exiting." | |
exit 1 | |
fi | |
log=$(docker inspect -f '{{.LogPath}}' $1 2> /dev/null) | |
truncate -s 0 $log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment