I have a docker image which executes a shell script that runs a series of Java programs.
I am finding that the script does not complete; on examination I find that one of the Java executables exited but is a zombie - the caller failed to reap the exit status.
I’ve simplified the scripts to a bare minimum and it’s consistently reproducible.
The script that’s executed when the container is:
#!/bin/bash
for f in 1 2 3 4 5 6 7 8 9 10
do
echo do $f
/tmp/bar
done
/tmp/bar is very simple too:
#!/bin/bash
java >> /tmp/j.out 2>&1
On startup the container never completes. It’s not consistent; the log may show that the first Java invocation was successful but it never gets through all 10. The same happens if I log on to the container using docker exec and run the script manually.
ps shows a java zombie, although what’s interesting is that unlike a normal Unix zombie the TIME field continues to increase.
Ok I’m still learning docker but since you asked for “any advice” here it is lol
You probably need the -d option for detached or -i for interactive (depending on how you want to run it)? I think I recall with no options it runs and quits/dies. If your stuff takes some time (which java always does) I’m thinking the container ends thus the zombie but I am guessing. So it’s “any Ideas” lol
I ran docker run --rm -t -i phusion/baseimage /sbin/my_init – bash -l
I connected to the container using docker exec, installed Java using apt-get install default-jre and executed java; no arguments, just called java from the shell. I got a zombie - never got the shell prompt back.
On closer examination I realized that the apt-get install hadn’t completed either
If it matters I’m running on a Mac, El Capitan, with VirtualBox 5.0.10 r104061 running boot2docker version 1.9.1 build a34a1d5 - the virtual machine has 4Gb RAM