Docker run –init parameter

Use the –init parameter to change the container’s process 1 to /sbin/docker-init

When the init parameter is not used, as shown in the figure below, pay attention to the differences

Kill process 25 and change the parent process of process 28 into process 1

Kill process 28 again and generate a verification in the zombie process by yourself. At this time, process 28 should become a zombie process. However, process 28 is recycled normally because process 1 of the container is docker init

Conclusion: when the –init parameter is used, the No. 1 process of the container is docker-init, which can normally recycle orphan processes, thus avoiding the problem of zombie processes under specific conditions

Send a Message