Created
October 7, 2017 18:16
-
-
Save kosfar/64e26929a0885c06fc10566d16a9919a to your computer and use it in GitHub Desktop.
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 | |
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) | |
if [ "$dockerdev" = "$DEVMAP" ]; then | |
taskdfn=$(docker inspect --format="{{ index .Config.Labels \"com.amazonaws.ecs.task-definition-family\"}}" $containerid) | |
echo -e "Containerid: $containerid\nTask definition:$taskdfn" | |
break | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment