Add init process for zombie fighting
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>
Upstream-commit: ee3ac3aa66bfb27b7c21dfb253fdaa113baedd4e
Component: engine
This commit is contained in:
@ -7,3 +7,4 @@ DOCKER_CONTAINERD_BINARY_NAME='docker-containerd'
|
||||
DOCKER_CONTAINERD_CTR_BINARY_NAME='docker-containerd-ctr'
|
||||
DOCKER_CONTAINERD_SHIM_BINARY_NAME='docker-containerd-shim'
|
||||
DOCKER_PROXY_BINARY_NAME='docker-proxy'
|
||||
DOCKER_INIT_BINARY_NAME='docker-init'
|
||||
|
||||
@ -12,5 +12,5 @@ set -e
|
||||
export BINARY_SHORT_NAME="$DOCKER_PROXY_BINARY_NAME"
|
||||
export SOURCE_PATH='./vendor/src/github.com/docker/libnetwork/cmd/proxy'
|
||||
source "${MAKEDIR}/.binary"
|
||||
copy_containerd "$DEST" 'hash'
|
||||
copy_binaries "$DEST" 'hash'
|
||||
)
|
||||
|
||||
@ -12,4 +12,5 @@ rm -rf "$DEST"
|
||||
install_binary "${DEST}/${DOCKER_CONTAINERD_CTR_BINARY_NAME}"
|
||||
install_binary "${DEST}/${DOCKER_CONTAINERD_SHIM_BINARY_NAME}"
|
||||
install_binary "${DEST}/${DOCKER_PROXY_BINARY_NAME}"
|
||||
install_binary "${DEST}/${DOCKER_INIT_BINARY_NAME}"
|
||||
)
|
||||
|
||||
@ -53,8 +53,8 @@ for d in "$CROSS/"*/*; do
|
||||
cp -L "$d/$PROXY_BINARY_FULLNAME" "$TAR_PATH/${DOCKER_PROXY_BINARY_NAME}${BINARY_EXTENSION}"
|
||||
fi
|
||||
|
||||
# copy over all the containerd binaries
|
||||
copy_containerd $TAR_PATH
|
||||
# copy over all the extra binaries
|
||||
copy_binaries $TAR_PATH
|
||||
|
||||
if [ "$IS_TAR" == "true" ]; then
|
||||
echo "Creating tgz from $BUILD_PATH and naming it $TGZ"
|
||||
|
||||
Reference in New Issue
Block a user