Skip to content

Instantly share code, notes, and snippets.

@keiranmraine
Created January 10, 2022 14:49
Show Gist options
  • Save keiranmraine/dfad125ee62044284f38c1e11f1a2e0d to your computer and use it in GitHub Desktop.
Save keiranmraine/dfad125ee62044284f38c1e11f1a2e0d to your computer and use it in GitHub Desktop.
Script to output docker stats suitable for file while job is running
#!/bin/bash
set -ue
CONTAINER_ID=$1
# include the header first time
docker stats --no-stream $CONTAINER_ID
while true; do
sleep 10
# will stop automatically once container is dead
docker stats --no-stream $CONTAINER_ID | grep -v '^CONTAINER'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment