📎 Webclip
Compile issues with Elixir/Phoenix in a Docker container
The thread describes a Phoenix app that compiles inside a Docker container at first, but fails after the container is restarted. The build folder loses compiled dependencies such as plug because Mix no longer sees them as dependencies.
José Valim points to Hex registry problems, and the original poster confirms that the missing piece was the ~/.hex directory. Mounting that folder as a volume makes compilation work again after restarts.
Reading notes#
- The project folder is mounted as a volume, so source files survive container restarts.
- After restarting the container, running mix compile removes some compiled dependencies under _build/dev/lib.
- The error shown is a MatchError tied to plug.app not being found.
- Running mix deps.get does not download anything new, but it makes compilation work again.
- José Valim says this happens when plug is no longer seen as a dependency.
- He suggests checking behavior with –no-compile or –no-deps-check.
- The reported cause is a missing ~/.hex registry after container restarts.
- Mounting $(pwd)/.hex to /root/.hex fixes the issue.
