Docker - nsenter tool to access the Docker container

less than 1 minute read

Installing nsenter in /usr/loca/bin directory

1
$ sudo docker run -v /usr/local/bin:/target jpetazzo/nsenter

Get the process id of container

1
PID=$(docker inspect --format  <container>)

Launching a shell inside the container

1
$ sudo nsenter --target $PID --mount --uts --ipc --net --pid

Run a ls command inside the container

1
$ sudo nsenter --target $PID --mount --uts --ipc --net --pid ls