Skip to content

Instantly share code, notes, and snippets.

@justincormack
Created February 9, 2017 17:15
Show Gist options
  • Save justincormack/f2444fbdf210b05d4f7baabe6fcd219a to your computer and use it in GitHub Desktop.
Save justincormack/f2444fbdf210b05d4f7baabe6fcd219a 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