Skip to content

Mix hangs when compiling code inside a Docker container #3342

Description

@jakubpawlowicz

I've stumbled upon this issue when building a Docker container containing Erlang 17 + Elixir 1.0.4 + Phoenix 0.13.1. If you check out https://github.com/jakubpawlowicz/elixir-docker-issue and run docker-compose build then it hangs at step 15 - RUN mix compile:

Step 15 : RUN mix compile
 ---> Running in 6e4208f2275c
==> fs (compile)
Compiled src/fs_app.erl
Compiled src/fs.erl
Compiled src/fs_sup.erl
Compiled src/sys/inotifywait_win32.erl
Compiled src/sys/inotifywait.erl
Compiled src/sys/fsevents.erl
Compiled src/fs_event_bridge.erl
Compiled src/fs_server.erl

However it works fine when I attach to the container and run mix compile from CLI.

One workaround I found is to run mix compile with SMP turned off, see https://github.com/jakubpawlowicz/elixir-docker-issue/blob/master/Dockerfile#L29:

elixir --erl "-smp disable" /usr/local/elixir/bin/mix compile

My setup:

  • OS X 10.10
  • VirtualBox 4.3.26
  • Boot2Docker 1.6
  • docker-compose 1.2

Couldn't verify using Elixir master as I haven't figure out how to compile it inside Docker image yet.

I wonder if it's because mix compile uses Kernel.ParallelCompiler but then it does not explain why it works fine from CLI. Could be an issue with Docker not playing well with parallel commands?
Any further ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions