Re: [PATCH 2/9 v2] Introduce nat/linux-namespaces.[ch]

Gary Benson
2015-05-07T08:42:08Z

Alban Crequy wrote:
> On Fri, May 1, 2015 at 1:29 PM, Gary Benson <gbenson@redhat.com> wrote:
> > Alban Crequy wrote:
> > > On Fri, May 1, 2015 at 11:28 AM, Gary Benson <gbenson@redhat.com> wrote:
> > > > The scenario I'm targeting is that you have an application you
> > > > want to debug running in a container. You don't want to run
> > > > GDB as root on the container host, so you start a second
> > > > container with just the privileges you need and run GDB from
> > > > there.
> > >
> > > How do you get the pid of the process to give as a parameter to
> > > "gdb -p" if gdb is running in a different pid namespace than the
> > > process to debug?
> >
> > It's the PID on the host, I've just been finding them with ps.
>
> But if you get the pid of the process to debug on the host, that pid
> is not meaningful in the container where GDB is running. How can
> tell gdb to attach to the pid if that pid is not visible in gdb's
> container?

Docker has an option --pid=host that starts a container without
creating a PID namespace for it. I'm starting the debugger container
with that option so it can see the host PID namespace.

Cheers,
Gary

--