Created
October 14, 2023 16:28
-
-
Save dublado/a0e0f8fdc8eaf7b62e4f061f097eca07 to your computer and use it in GitHub Desktop.
docker log size container list
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 | |
# Get list of all container IDs | |
container_ids=$(docker ps -q) | |
# Iterate through each container ID | |
for id in $container_ids; do | |
# Get container name for better readability | |
container_name=$(docker inspect --format='{{.Name}}' $id | sed 's/\///') | |
# Get log path | |
log_path=$(docker inspect --format='{{.LogPath}}' $id) | |
# Get log size | |
log_size=$(ls -lh $log_path | awk '{print $5}') | |
echo "Container: $container_name, Log Size: $log_size" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment