Docker + Elixir + Phoenixframework

Just playing around docker and elixir. The followings are some notes about deploying sample phoenixframework application on docker.

Deploying using Vagrant is just adding the recipe to the chef.run_list.

config.vm.provision :chef_solo do |chef|
  chef.run_list = [


Creating Eixir Container for Docker

It’s just installing the erlang pack and then build elixir.

# Install base package
RUN apt-get update
RUN apt-get install -y wget git build-essential

# Install Erlang
RUN wget
RUN dpkg -i erlang-solutions_1.0_all.deb
RUN apt-get update
RUN apt-get install -y erlang

# Install Elixir
WORKDIR /tmp/elixir-build
RUN git clone
WORKDIR elixir
RUN git checkout v0.14.2 && make && make install

Creating Phoenix Application Container for Docker

It’s about fetching git repo and comple and start with “mix run” with “–no-halt” option. I’ve used phoenix-docker-example as reference.

## Prerequisites ##
RUN mix do local.rebar, local.hex --force

## Fetch the phoenix application ##
WORKDIR /usr/local/lib
RUN git clone

## Compile ##
WORKDIR spawn_viewer
RUN mix do deps.get, compile

CMD ["mix", "run", "-e", "SpawnViewer.Router.start", "--no-deps-check", "--no-compile", "--no-halt"]


Deploying Phoenix Application using Chef

chef-dooker makes it pretty easy to configure parameters for docker deployment.

# Pull latest image
docker_image 'parroty/docker-spawn-viewer'

# Run container exposing ports
docker_container 'parroty/docker-spawn-viewer' do
  detach true
  port '4000:4000'

Posted on July 19, 2014, in Elixir, Web. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: