-
-
Save cqsd/3d59e937b74ba270b8c4c39e5b1e4307 to your computer and use it in GitHub Desktop.
run a shell in the docker host (use on dOckeR for mac or windoze)
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/sh | |
# (in kubernetes, you'd use AllowPrivilegeEscalation probably, idk. exercise for the reader) | |
docker run -it \ | |
--privileged \ | |
--pid=host \ | |
alpine \ | |
nsenter -t 1 -m -u -n -i bash | |
# nsenter # exec something in a namespace (analogous to su -c) | |
# -t 1 # take contexts from pid 1 (ie when we enter namespaces later, we are using the ones seen by pid 1) | |
# -m # enter the pid 1 mount ns | |
# -u # enter the pid 1 uts ns | |
# -n # enter the pid 1 net ns | |
# -i # enter the pid 1 ipc ns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment