Skip to content

Instantly share code, notes, and snippets.

@philipz
Forked from justincormack/enter for debug
Created February 17, 2017 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipz/5df92196f1020a71cc53ab6ba25d0b7a to your computer and use it in GitHub Desktop.
Save philipz/5df92196f1020a71cc53ab6ba25d0b7a to your computer and use it in GitHub Desktop.
I have run an nginx container...
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6d67de07731d nginx "nginx -g 'daemon ..." 40 minutes ago Up 40 minutes 80/tcp, 443/tcp epic_goldberg
I want to use Debian for debug:
docker run -it --pid=container:6d67de07731d --net=container:6d67de07731d --cap-add sys_admin debian
I can see the nginx process:
root@6d67de07731d:/# ps auxww | grep nginx
root 1 0.0 0.2 31868 5116 ? Ss 16:54 0:00 nginx: master process nginx -g daemon off;
104 6 0.0 0.1 32256 2836 ? S 16:54 0:00 nginx: worker process
root 58 0.0 0.0 11128 928 ? S+ 17:10 0:00 grep nginx
I can change into the filesystem of the nginx process:
root@6d67de07731d:/# cd /proc/1/root/.
root@6d67de07731d:/proc/1/root# find . -name nginx
./etc/default/nginx
./etc/init.d/nginx
./etc/logrotate.d/nginx
./etc/nginx
./var/cache/nginx
./var/log/nginx
./usr/lib/x86_64-linux-gnu/perl5/5.20/auto/nginx
./usr/lib/nginx
./usr/sbin/nginx
./usr/share/lintian/overrides/nginx
./usr/share/doc/nginx
./usr/share/nginx
(it could be a little easier to do this...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment