This all comes from this blog post.
User the strace
container using the same pid
and net
than the target.
To strace
a container named web
:
$ docker run -t --pid=container:web --net=container:web --cap-add sys_admin --cap-add sys_ptrace strace
Or also simply launch an Alpine shell:
$ docker run -it --pid=container:web --net=container:web --cap-add sys_admin alpine sh