Created
October 5, 2021 20:42
-
-
Save Gronis/5b5d75dce2ebd30c1f40a8276798c4d0 to your computer and use it in GitHub Desktop.
Docker shell scripts
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 | |
date "+%Y-%m-%d %H:%M:%S" | |
sudo sh -c 'truncate -s 0 $(docker system info 2> /dev/null | grep "Docker Root Dir" | cut -d ":" -f2 | cut -d " " -f2-)/containers/*/*-json.log'; |
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 | |
# Remove images older than 1 week that has repository or tag <none> | |
docker rmi $(docker images | grep "<none>" | grep " [weeks|months]* ago" | awk '{print $3}') 2> /dev/null || true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment