Elixir in Docker, slow `mix test` when docker `--network none` specified

I’m running Elixir in a docker container using the --network none option to test untrusted code with mix compile and mix test.

There is a noticable slowdown as it appears to wait for some sort of network timeout. There is no slowdown/delay without the --network none option specified.

Is there a way to run mix compile and mix test without the network? Is there an erl flag that I can pass along to run without the network?

After doing more research, we discovered that this seems to be related to the BEAM itself.

Even erl does have noticable start up times. It took 3 to 5 seconds to “boot” into it when docker was started with --network=none on any alpine base images I tried. I randomly picked some from hexpm/erlang as well as erlang ones.

I also played with available EPMD settings, though they didn’t seem to change anything.

Ubunto and Debian based images (again hexpm/erlang and erlang) did not suffer from this problem and prompted for input when starting erl without any noticable delay, regardless of the --network flag when starting docker.

We therefore currently assume that this related to implementation differences between libmusl and glibc, and not related to the BEAM itself.


AS @NobbZ mentions, some updates which points to differences between libmusl and glibc.

When running alpine-based images (docker run -it --rm -network none --entrypoint iex elixir:1.10.4-alpine) there is a a notable delay (3-5s) when starting iex that doesn’t occur with debian/ubuntu-based images (docker run -it --rm -network none --entrypoint iex elixir:1.10.4-slim)