Skip to content

Instantly share code, notes, and snippets.

@jostyee
Forked from mikechau/docker-memory.sh
Created September 7, 2017 06:44
Show Gist options
  • Select an option

  • Save jostyee/20c0029216bc724e73e65e7b13e2f1a8 to your computer and use it in GitHub Desktop.

Select an option

Save jostyee/20c0029216bc724e73e65e7b13e2f1a8 to your computer and use it in GitHub Desktop.
# http://www.commandlinefu.com/commands/view/13708/show-memory-usage-of-all-docker-lxc-containers
for line in `docker ps | awk '{print $1}' | grep -v CONTAINER`; do docker ps | grep $line | awk '{printf $NF" "}' && echo $(( `cat /sys/fs/cgroup/memory/docker/$line*/memory.usage_in_bytes` / 1024 / 1024 ))MB ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment