Docker

From GHER

Jump to: navigation, search

Enter inside a Docker container

You can enter inside a Docker container with the command nsenter. If this command is not available on your distribution (which is the case for e.g. Ubuntu 14.04) , you can build a as follows:

VERSION=2.24
curl https://www.kernel.org/pub/linux/utils/util-linux/v$VERSION/util-linux-$VERSION.tar.gz| tar -zxf-
ln -s util-linux-$VERSION util-linux
cd util-linux
./configure --without-ncurses --prefix=/usr/local
make LDFLAGS=-all-static nsenter
sudo cp nsenter /usr/local/bin/

The script docker-enter automatically gets the process id from the container name. It can be installed by:

wget https://raw.githubusercontent.com/jpetazzo/nsenter/master/docker-enter
chmod +x docker-enter 
sudo cp docker-enter /usr/local/bin/

On can enter inside a docker container by issuing, where "OceanBrowser-gher-container" is the name of the container:

sudo docker-enter OceanBrowser-gher-container

Reference

Personal tools