Last active
August 29, 2015 14:05
-
-
Save scarfacedeb/4c97d48b41693a9fa67d to your computer and use it in GitHub Desktop.
A shortcut to access docker container without sshd
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # A shortcut to access docker container without sshd | |
| # | |
| # See: http://blog.docker.com/2014/06/why-you-dont-need-to-run-sshd-in-docker/ | |
| # | |
| # Usage: inspect_docker 7361ceaf8cd3 # container ID | |
| # inspect_docker pensive_turing # container name | |
| if ! [[ $1 ]]; then | |
| echo "You need to specify container ID" | |
| exit 0 | |
| fi | |
| PID=$(docker inspect --format {{.State.Pid}} $1) | |
| nsenter --target $PID --mount --uts --ipc --net --pid /bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment