Created
November 3, 2014 15:18
-
-
Save stevenmc/e72a30ed82efa5e6a9f1 to your computer and use it in GitHub Desktop.
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 | |
# | |
# Presume suspicious_euclid is the id of the Docker container, from docker ps | |
# Requirements: nsenter - https://blog.codecentric.de/en/2014/07/enter-docker-container/ | |
# Suggestion: move to /usr/local/bin and remove the sh extension, then you just run dockerssh suspicious_euclid | |
# Usage: sudo ./dockerssh.sh suspicious_euclid | |
if [ -z "$1" ]; then | |
echo "Please pass a docker container id or name to this script." | |
exit; | |
fi | |
sudo nsenter --target $(docker inspect --format "{{ .State.Pid }}" $1) --mount --uts --ipc --net --pid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment