Skip to content

Instantly share code, notes, and snippets.

@taikedz
Created April 24, 2018 22:15
Show Gist options
  • Save taikedz/4bf51b8fb973ce265c1e1988b80b0a5c to your computer and use it in GitHub Desktop.
Save taikedz/4bf51b8fb973ce265c1e1988b80b0a5c to your computer and use it in GitHub Desktop.
Troubleshoot a container instance
#!/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