Skip to content

Instantly share code, notes, and snippets.

@giobyte8
Forked from mbn18/gist:0d6ff5cb217c36419661
Last active September 10, 2015 02:15
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 giobyte8/0c11f5b8593c75c099db to your computer and use it in GitHub Desktop.
Save giobyte8/0c11f5b8593c75c099db to your computer and use it in GitHub Desktop.
How to install nsenter on Ubuntu 14.04
# Ubuntu 14.04 don't have nsenter - the straight forward way required me to install build tools and etc.
# I preferred to keep the system clean and install nsenter in a container and then copy the command to the host
# Note - its also possible to run nsenter from a container (didn't tried) https://github.com/jpetazzo/nsenter
# start a container
docker run --name nsenter -it ubuntu:14.04 bash
## in the docker
apt-get update
apt-get install git build-essential libncurses5-dev libslang2-dev gettext zlib1g-dev libselinux1-dev debhelper lsb-release pkg-config po-debconf autoconf automake autopoint libtool
git clone git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git util-linux
cd util-linux/
./autogen.sh
./configure --without-python --disable-all-programs --enable-nsenter
make
## from different shell - on the host
sudo docker cp nsenter:/util-linux/nsenter /usr/local/bin/
sudo docker cp nsenter:/util-linux/bash-completion/nsenter /etc/bash_completion.d/nsenter
## Start another terminal from host (Or another) machine:
PID=$(docker inspect --format {{.State.Pid}} 04fe75de21d4)
sudo nsenter --target $PID --mount --uts --ipc --net --pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment