Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

add init option in docker run, help reaping zombie processes #1435

Merged
merged 3 commits into from
Sep 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/rest-server/src/templates/yarnContainerScript.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ docker pull {{{ jobData.image }}} \
## ATTENTION: do not specify `--pid=host` when run job, otherwise job-exporter can not get right
## network consumption
docker run --name $docker_name \
--init \
--rm \
--tty \
--privileged=false \
Expand All @@ -275,6 +276,6 @@ docker run --name $docker_name \
--label PAI_USER_NAME={{{ jobData.userName }}} \
--label PAI_CURRENT_TASK_ROLE_NAME={{{ taskData.name }}} \
--env-file $ENV_LIST \
--entrypoint '/bin/bash' {{{ jobData.image }}} \
'/pai/bootstrap/docker_bootstrap.sh'
{{{ jobData.image }}} \
/bin/bash '/pai/bootstrap/docker_bootstrap.sh'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will set the pid of "bash docker_bootstrap.sh" to 1? it seems previously it is already the case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not actually:
Without --init, pid 1 process is bash docker_bootstrap.sh.
With --init, pid 1 process is /dev/init, and bash docker_bootstrap.sh will be its subprocess.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@mzmssg mzmssg Sep 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing, --init can fix the suicide failure as well. it is a good solution to such issues.

https://stackoverflow.com/questions/49162358/docker-init-zombies-why-does-it-matter

krallin/tini#8 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/krallin/tini#understanding-tini. if the child of process exits, init will exit