mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
This adds a small C binary for fighting zombies. It is mounted under
`/dev/init` and is prepended to the args specified by the user. You
enable it via a daemon flag, `dockerd --init`, as it is disable by
default for backwards compat.
You can also override the daemon option or specify this on a per
container basis with `docker run --init=true|false`.
You can test this by running a process like this as the pid 1 in a
container and see the extra zombie that appears in the container as it
is running.
```c
int main(int argc, char ** argv) {
pid_t pid = fork();
if (pid == 0) {
pid = fork();
if (pid == 0) {
exit(0);
}
sleep(3);
exit(0);
}
printf("got pid %d and exited\n", pid);
sleep(20);
}
```
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
16 lines
407 B
Bash
16 lines
407 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
[ -z "$KEEPDEST" ] && \
|
|
rm -rf "$DEST"
|
|
|
|
(
|
|
source "${MAKEDIR}/.binary-setup"
|
|
export BINARY_SHORT_NAME="$DOCKER_DAEMON_BINARY_NAME"
|
|
export SOURCE_PATH='./cmd/dockerd'
|
|
source "${MAKEDIR}/.binary"
|
|
export BINARY_SHORT_NAME="$DOCKER_PROXY_BINARY_NAME"
|
|
export SOURCE_PATH='./vendor/src/github.com/docker/libnetwork/cmd/proxy'
|
|
source "${MAKEDIR}/.binary"
|
|
copy_binaries "$DEST" 'hash'
|
|
)
|