DEV Community

Discussion on: Using Docker for your Elixir Phoenix application

Collapse
 
eikooc profile image
Jamie Neubert Pedersen

Hi Susumu ( @zacky1972 ). Thanks for your question.
It seems like if you want to generate a new phoenix project you are asked if you want to install dependencies. Docker exits abruptly on that question without adding -it to the run command. Can I get you to try your above example again, but instead do:

docker run -it --mount type=bind,source=$(pwd),target=/app -p 4000:4000 --rm elixir-env:latest mix phx.new --no-ecto test
cd test
Enter fullscreen mode Exit fullscreen mode

This should allow you to install the dependencies interactively.

But the actual issue is a change that happened to the config/dev.exs file, only allowing access from the same computer. Just change the http in that file to allow access from 0.0.0.0 like so:

# from this:
http: [ip: {127, 0, 0, 1}, port: 4000],
# to this:
http: [ip: {0, 0, 0, 0}, port: 4000],
Enter fullscreen mode Exit fullscreen mode

Then launch the phoenix server again with:

docker run --mount type=bind,source=$(pwd),target=/app -p 4000:4000 --rm elixir-env:latest mix phx.server
Enter fullscreen mode Exit fullscreen mode

Btw, I liked your talks at Elixir Conf.

Collapse
 
zacky1972 profile image
Susumu Yamazaki

I did it according to your answer and it was done! Thank you so much.

And also, thank you for watching and listening to my talk!