Last active
August 29, 2015 14:04
-
-
Save lox/d210a74d3c2f317786ab to your computer and use it in GitHub Desktop.
Install nsenter and docker-enter on any Ubuntu host
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 | |
if [[ $EUID -ne 0 ]]; then | |
echo "You must be root to execute this script" 2>&1 | |
else | |
PID=$(docker inspect --format "{{ .State.Pid }}" "$1") | |
nsenter --target $PID --mount --uts --ipc --net --pid | |
fi |
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 | |
set -e | |
curl -o util-linux_2.24-1~1_amd64.deb "http://ppa.launchpad.net/78luphr0rnk2nuqimstywepozxn9kl19tqh0tx66b5dki1xxsh5mkz9gl-launchpad-a811i2i3ytqlsztthjth0svbccw8inm65tmkqp9sarr553jq53in4xm1m/util-linux/ubuntu/pool/main/u/util-linux/util-linux_2.24-1~1_amd64.deb" | |
sudo dpkg --install --ignore-depends=libblkid1,libmount1,libsmartcols1 --force-overwrite util-linux_2.24-1~1_amd64.deb | |
sudo curl -o /usr/local/bin/docker-enter https://gist.githubusercontent.com/lox/d210a74d3c2f317786ab/raw/docker-enter | |
sudo chmod +x /usr/local/bin/docker-enter |
I'm sure ignoring those dependencies is horrible. The alternative was grabbing a deb from a PPA directly.
This turned out to be a terrible idea, instead:
docker run --rm -v /usr/local/bin:/target yungsang/nsinit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To install:
curl https://gist.githubusercontent.com/lox/d210a74d3c2f317786ab/raw/install-nsenter.sh | bash