Created
April 24, 2018 22:15
-
-
Save taikedz/4bf51b8fb973ce265c1e1988b80b0a5c to your computer and use it in GitHub Desktop.
Troubleshoot a container instance
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 | |
printhelp() { | |
cat <<EOF | |
dwat CONTAINER [CMD ...] | |
EOF | |
} | |
container="$1"; shift | |
[[ -n "$container" ]] || { | |
printhelp | |
exit 1 | |
} | |
image="$container-broken" | |
cmnd="${1:-/bin/bash}"; shift | |
set -x | |
docker commit "$container" "$image" | |
docker run -it --rm --entrypoint="$cmnd" "$image" "$@" | |
docker rmi "$image" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment