Skip to content

Instantly share code, notes, and snippets.

@aweiteka
Created July 17, 2014 16:01
Show Gist options
  • Save aweiteka/63b0a607a3ef142b974b to your computer and use it in GitHub Desktop.
Save aweiteka/63b0a607a3ef142b974b to your computer and use it in GitHub Desktop.
drop into running docker container shell using nsenter
#!/usr/bin/env bash
# drop into running docker container shell
if [ -z "$1" ]; then
echo "USAGE: ./`basename $0` <container_id>"
exit 1
fi
PID=$(docker inspect --format '{{ .State.Pid }}' $1)
nsenter -m -u -n -i -p -t $PID /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment