Created
December 18, 2015 23:28
-
-
Save marcingrzejszczak/49e500522753a48aced5 to your computer and use it in GitHub Desktop.
Cat X lines of running docker containers
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 | |
NUMBER_OF_LINES_TO_LOG=200 | |
docker ps | sed -n '1!p' > /tmp/containers.txt | |
while read field1 field2 field3; do | |
echo -e "\n\nContainer name [$field2] with id [$field1] logs: \n\n" | |
docker logs --tail=$NUMBER_OF_LINES_TO_LOG -t $field1 | |
done < /tmp/containers.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment