Running Elixir In A Docker Pod

Hi all!

I followed this excellent guide: Use Docker to create an Elixir/Phoenix development environment | by Cesar William Alvarenga | The Startup | Medium to get started on creating a Phoenix instance inside a docker pod. But there were a few minor things I needed in addition to this to get this working and I thought I’d share them for what it’s worth:

1.) In my case I’m on Ubuntu so I had to read the instructions here: Install Docker Engine on Ubuntu | Docker Documentation to get things configured correctly. Specifically making sure I’d removed old versions of docker and I had the other pre-requisites covered as well.

2.) I prefer to run with a non-root user (less likelihood of fouling something up which cannot be undone on my machine). So after I had installed Docker I also ran the instructions here: Post-installation steps for Linux | Docker Documentation to make it possible for me to run Docker as a non-root user.

3.) Finally when I got everything working as expected, I had to modify the dev.exs file to change the http: setting from 127.0.0.1 to 0.0.0.0; otherwise when I tried to access localhost:4000 it wasn’t working.

I hope this might save others a bit of work.

2 Likes