Install nsenter from source

Written on August 5, 2014 by Kev

nsenter is a great command line tool for accessing docker containers. Unfortunately  it isn’t available in Ubuntu 14.04 at the time of writing. Fortunately building it from source is quite simple.

Get the latest version of util-linux from kernel.org https://www.kernel.org/pub/linux/utils/util-linux/

At the time of writing the latest version was v2.25, which is the version used in the examples here.

Install the build dependencies

sudo apt-get install build-essential libncurses5-dev libslang2-dev gettext zlib1g-dev \
libselinux1-dev debhelper lsb-release pkg-config po-debconf autoconf \
automake autopoint libtool python2.7-dev

Download the util-linux package source code (this contains nsenter)

cd /tmp
wget https://www.kernel.org/pub/linux/utils/util-linux/v2.25/util-linux-2.25.tar.gz
tar -xvf util-linux-2.25.tar.gz

Now we’ll compile the nsenter program

cd util-linux-2.25
./configure
make nsenter
sudo cp nsenter /usr/local/bin

Confirm that nsenter in installed

nsenter --version

should return: nsenter from util-linux 2.25