[erlang-questions] Strange interaction between Docker and Erlangs ports (exit_status lost)

André Cruz andre@REDACTED
Thu Dec 17 12:47:27 CET 2015


On 17 Dec 2015, at 10:31, Alexey Lebedeff <binarin@REDACTED> wrote:
> 
> Ah, docker at its best )
> 
> $ for iter in $(seq 1 100); do echo -n "$iter " 1>&2 ; docker run --rm edevil/docker-erlang-bug bash -c "sleep 1; erl -noshell -s test run -s init stop" 2>/dev/null; done | sort | uniq -c
>     100 SUCCESS
> 
> but
> 
> for iter in $(seq 1 100); do echo -n "$iter " 1>&2 ; docker run --rm edevil/docker-erlang-bug erl -noshell -s test run -s init stop 2>/dev/null; done | sort | uniq -c
>      12 FAILED
>      88 SUCCESS
> 
> So you should either use bash/sleep trick or try find a bug in docker. Honestly, I just gave up ) Especially given that it's not very convinient to use erlang distribution inside docker containers without something like weavedns.

There are some subtle changes that somehow mitigate the problem, for example:

$ docker run edevil/docker-erlang-bug bash -c "erl -noshell -s test run -s init stop 1>&1"
SUCCESS

Notice the strange stdout redirect. Without it:

$ docker run edevil/docker-erlang-bug bash -c "erl -noshell -s test run -s init stop"
FAILED

It seems to me that the Erlang port is not aware that the external command has completed. Can we be sure this is a Docker problem and not some incorrect assumption by the Beam VM about its environment? This recent e-mail http://erlang.org/pipermail/erlang-questions/2015-October/086590.html talks about launched processes being on another process session, can this be related?

André


More information about the erlang-questions mailing list