Skip to main content

Log docker stats to a file

Published: 2019-10-01

Recently I needed to log the output of docker stats for a few of my containers in order to compare. The following snippet will log container stats to a file (stats.txt), and to stdout, every 1 second. Tweak it to your liking.

while true; do docker stats --no-stream | tee --append stats.txt; sleep 1; done