Created
July 27, 2014 08:19
-
-
Save bivas/b4b6ab42c01bcc06779e to your computer and use it in GitHub Desktop.
Place this in /etc/profile.d/ folder and you can open a shell in a running Docker container
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 | |
function docker-sh() { | |
local __PID="" | |
__PID=$(docker inspect --format "{{.State.Pid}}" $1) | |
local __EXIT=$? | |
if [ $__EXIT -eq 0 ]; then | |
nsenter --target $__PID --mount --uts --ipc --net --pid | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment