Dockerize, a small package to help generating Docker images for your Elixir projects

Dockerize - A small hex package for creating Docker images from an Elixir project.

Hi, guys,

I’ve been playing with Elixir and Docker together for some time and today I’d like to share some of my experiences on running Elixir on Docker to the community. This includes:

  • Dockerize - the hex package that helps scaffolding
  • Two Docker base images: elixir-builder & elixir-runner, used by this package by default.

Also, I wrote a blog post on how to do it manually if you want to build your own stacks.

This is a tiny library and many others may have better solutions, but I think it will provide most of the developers a good start on deployment.

So, please check it if you’re going to de deployments, and don’t hesitate to drop any comment or advice. It will help me improving it definitely.



v0.2.0 updates

  • faster building speed, normally arround 3min with fresh (depending on your project) and seconds with cache
  • smaller size of the final built image, ~30MB
  • better support for Phoenix projects. Now it automatically detect if you are in a Phoenix project.

v1.0.0 released!

  • use explicit base Docker images from scratch so developers can have full control
  • use Debian instead of Alpine as the system image by default (to trade-off for better maintainability)
  • documentation improvements

Welcome to give it a try!


Can you clarify on that? I am not a heavy Docker user but I do use it and so far I’ve had no problems with Alpine.

1 Like

Yes! Alpine is surely amazing. I am a fan of it too but I found that I have to deal with the differences between musl and standard libc. If the library owner uses NIF and doesn’t provide prebuilt binaries, we have to compile it ourselves. Compiling on Alphine today is a bit harder than Debian because musl is not the majority. I’m sure it will get better as Alpine becomes more and more popular.

I picked Alpine because it is super small. But today thanks to Docker layer caching and cloud building, we don’t need to build locally and push to remote, sizing is not a big problem now. making the library smoother to adapt seems more important to me.


Yep, I’ve been bitten once by libmusl when working actively with Rust last year (by the famous slower memory allocation) but I haven’t revisited in a while and I am curious if that has been fixed.

As for NIFs and prebuilt binaries I prefer them built in the container anyway but I get what you are saying! :slight_smile:

Yep, got introduced to that several months ago and I loved it. I wonder if people are updating their Docker files en masse to make use of this fantastic feature, hmmmm.

Thanks for this. Any plans on doing a write-up on Rio? I like how it will fetch and maintain Let’s Encrypt certs for you.

I was shocked by how it simplified the certification flow and image building flow when I tried Rio a year ago. It’s a good direction but by that time it was unstable. I am glad to take your suggestion and give it another try!

1 Like

Today I released version v1.1.0.


  • support building assets with esbuild in Phoenix 1.6
  • some improvements on the usage of ARG and ENV instructures.