Merge pull request #27470 from runcom/expose-exec-pid

record pid of exec'd process
Upstream-commit: 13fd75c3dd18e6d57b6b28097fd7e0d0989c1b9e
Component: engine
This commit is contained in:
Vincent Demeester
2016-10-20 21:36:21 +02:00
committed by GitHub
15 changed files with 210 additions and 189 deletions

View File

@ -212,9 +212,13 @@ func (d *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.R
attachErr := container.AttachStreams(ctx, ec.StreamConfig, ec.OpenStdin, true, ec.Tty, cStdin, cStdout, cStderr, ec.DetachKeys)
if err := d.containerd.AddProcess(ctx, c.ID, name, p); err != nil {
systemPid, err := d.containerd.AddProcess(ctx, c.ID, name, p)
if err != nil {
return err
}
ec.Lock()
ec.Pid = systemPid
ec.Unlock()
select {
case <-ctx.Done():

View File

@ -28,6 +28,7 @@ type Config struct {
Privileged bool
User string
Env []string
Pid int
}
// NewConfig initializes the a new exec configuration

View File

@ -209,6 +209,7 @@ func (daemon *Daemon) ContainerExecInspect(id string) (*backend.ExecInspect, err
CanRemove: e.CanRemove,
ContainerID: e.ContainerID,
DetachKeys: e.DetachKeys,
Pid: e.Pid,
}, nil
}