Skip to content

Instantly share code, notes, and snippets.

@stevenmc
Created November 3, 2014 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenmc/e72a30ed82efa5e6a9f1 to your computer and use it in GitHub Desktop.
Save stevenmc/e72a30ed82efa5e6a9f1 to your computer and use it in GitHub Desktop.
#!/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