Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
for i in $(find /cgroup/memory/docker/* -type d); do
CONTAINER_ID=$(echo $i | awk -F'/' '{print $5}')
CONTAINER_NAME=$(docker ps --no-trunc | grep $CONTAINER_ID | awk '{print $2}')
MEM_LIMIT=$(($(cat $i/memory.limit_in_bytes)/1024/1024))
MEM_USED=$(($(cat $i/memory.usage_in_bytes)/1024/1024))
printf "%30s\t%5sM\t%5sM\t%s\n" $CONTAINER_NAME $MEM_LIMIT $MEM_USED $CONTAINER_ID
done
#!/bin/bash
DEV="/dev/$1"
# `dmsetup info` is an option too, but needs root and still `find`
# is more interesting
DEVMAP=$(find -L /dev/mapper/ -samefile $DEV | sed -e "s/^\/dev\/mapper\///")
for containerid in $(docker ps -q); do
dockerdev=$(docker inspect --format='{{.GraphDriver.Data.DeviceName}}' $containerid)

Keybase proof

I hereby claim:

  • I am kosfar on github.
  • I am kosfar (https://keybase.io/kosfar) on keybase.
  • I have a public key whose fingerprint is 398C D765 C387 FEFC B6C6 588F 121F EAA0 B17C C0E1

To claim this, I am signing this object:

* Module 1,2: The phoenix project + Goldratt
Theory of constraints
https://en.wikipedia.org/wiki/Theory_of_constraints
Four types of work:
Business projects: backed by dev project, tracked
Internal IT projects: infra, operations, automation, not visible
Operational change: distanced from business projects
Unplanned work: generated from failures, audits, tracked by problem tickets