Quantcast
Channel: Łukasz Gozda Gandecki
Viewing all articles
Browse latest Browse all 10

How to get inside a running docker

$
0
0

Still learning about docker.. I was doing some silly things, like, running docker run -i -t /bin/bash on a docker to get inside and investigate.. I did not realize at first that this command actually was starting a new docker everytime.
Turns out, to actually get inside a running docker you have to do three things, first:

install nsenter:
docker run -v /usr/local/bin:/target jpetazzo/nsenter

find pid of your docker:
PID=$(docker inspect --format {{.State.Pid}} CONTAINER_NAME_OR_ID)

Use nsenter to get inside.
nsenter --target $PID --mount --uts --ipc --net --pid

Learned this from a blog post at http://blog.docker.com/2014/06/why-you-dont-need-to-run-sshd-in-docker/


Viewing all articles
Browse latest Browse all 10

Trending Articles