Unable to build Docker image for basic Phoenix app. Only scaffolded code


I’m trying to build a Docker image of my Phoenix-app, but it fails:

> 1.042 07:14:20.687 [notice] Application ssl exited: exited in: :ssl_app.start(:normal, [])
> 1.042 ** (EXIT) an exception was raised:
> 1.042 ** (ArgumentError) could not call Module.put_attribute/3 because 
the module SqliteDbTest.MixProject is already compiled

I have made an example repo that reproduces the error. The full error log is attached to the README.

Running the application works fine in test, prod and dev environments.
It’s just the building of the docker image that fails.

I’m running Docker Desktop 4.28 with “Use Rosetta for x86_64/amd64 emulation on Apple Silicon” enabled. I’m on Ventura 13.0.

Turns out that I’m able to build if I use the buildx option, which enables the BuildKit builder.

E.g. docker buildx build .

1 Like

You can put DOCKER_BUILDKIT=1 in your shell initialization script and achieve the same behavior by default.

Thanks, @dimitarvp!
I’ll put that in my .profile