dotcloud/docker — pull request #5775 by bernerdschaefer (2014-05-13 13:50:55+00:00)
Title: nsinit.Exec() forwards signals to child

This makes nsinit behave better when started by a process supervisor (e.g., systemd).

Previously, given a systemd service definition like:

```
WorkingDirectory=/path/to/container/root
ExecStart=nsinit exec web
```

Then only way to cleanly stop the service was:

1. Ensure the parent cgroup value in `container.json`, so the child process moved to an ephemeral scope.
2. Disable the nsinit service (NOT stop it!)
3. Stop the scope.

Attempting to stop the nsinit service would cause the status to be "failed" (exit status 2) and the child process still running.

With this changeset, an nsinit service can be cleanly stopped whether it uses scopes or not, and the child will also be stopped.