Docker Community Forums

Share and learn in the Docker community.

Killing running container leaves parent docker process defunct

I am spawning multiple docker container using docker CLI commands from python sub process with bash support. Many a time I have need to kill the running container instance. I use docker kill command to kill the running container which works most if the time. But sometimes it leaves the docker process defunct due to which my parent process gets hangs as the child process is defunct(zombie).

root 15170 14983 0 05:59 ? 00:00:00 python3 /test/
root 15533 15170 0 06:00 ? 00:00:00 [docker]

Has anybody come across such issues and what could the probable solution for this. I don’t think this is a reap problem as its has default init system with the container ? Also, we have a requirement where I don’t want the parent to get killed as it keeps spawning container one after other