Attach to your Docker containers with ease using nsenter
Using nsenter you can enter your docker containers and inspect what is going on inside:
sudo nsenter -t $(docker inspect --format '{{ .State.Pid }}' $(docker ps -lq)) -m -u -i -n -p -w
The above will enter you into the latest running container on your host.
$(docker inspect --format '{{ .State.Pid }}' [container_id])
This returns the PID of the specified container which we pass into the -t
option of nsenter
by formatting the JSON output of docker inspect
.
$(docker ps -lq)
This returns the container ID of the last running container (-q
means only container ID and -l
means lastest).
Written by Chris McKinnel
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#