How do I run Elixir Phoenix Docker in production mode using example from Phoenix Guides?

I asked a question on StackOverflow and am not sure of the etiquette, do I just post a link (https://stackoverflow.com/questions/58163103/how-do-i-run-elixir-phoenix-docker-in-production-mode-using-example-from-phoenix) or do I ask the entire question here too?

To summarize, I’m trying to run a container with a vanilla phoenix app using the example Dockerfile on the Phoenix Guides but I keep running into issues with the image. Can anyone tell me what the bare minimum is to get it to work including the docker run command?

Thank you so much

Step 1 -> install and verify if your Docker is running.

Step 2 -> Use this image https://hub.docker.com/r/bitwalker/alpine-elixir-phoenix/

Step 3 -> Enjoy !

Thank you so much for responding. :clap:

By changing the base image (and all subsequent commands, and not using elixir releases) are you saying I should not try to do it with the example image or use elixir releases? If so, can you explain why?

I had my :broken_heart: set on using the example image with the new releases but due to a lack of a clear path I may have to settle on alternatives… (╯°□°)╯︵ ┻━┻

If you are looking to run your Phoenix app from within a container built via mix releases, I have an in depth tutorial that I wrote on my blog: https://akoutmos.com/post/multipart-docker-and-elixir-1.9-releases/

When I wrote the post 1.9 was still in RC so the base image I use is an Erlang image. But if you look in the Disqus comments I also provide an updated Dockerfile for use with the official Elixir image.

Hope that helps!

2 Likes

Take a look at how to create releases.
https://hexdocs.pm/mix/Mix.Tasks.Release.html
You can use it inside the container to run your app in production mode.