DEV Community

Cover image for Dockerizing Phoenix Development (1) Introduction
Alastair Measures
Alastair Measures

Posted on

Dockerizing Phoenix Development (1) Introduction

The overall objective here is to construct a development environment within Docker for a website based on: Phoenix and Elixir backed by PostgreSQL with PostGIS.

The plan is to have the Elixir and Phoenix work entirely within the container, even allowing projects to be started from scratch; thereby removing the need to have Elixir and Phoenix installed on the host machine.

The intention here is that these steps will get a relative newcomer up and running: with some understanding. It is written to be relatively gentle on the reader, if a bit slow for some.

For those not yet familiar: PostGIS is a group of extensions for PostgreSQL which include geographical capabilities that are both sophisticated and standards compliant .


Using Docker so that the project:

  • can be reproduced on demand for colleagues or others.
  • is largely prepared for deployment through Docker.
  • can co-exist with other projects using different version permutations.

Choosing/ constructing Docker images so that they are lean and targetted to the purpose in hand.

To enable IDEs and other tools (on the host machine) to work with source code inside a container.

Using 'docker-compose' so that parameters are scripted in the YAML format for clarity and simplicity.

Prerequisites and Platforms

This exercise was constructed and tested on the following platform:

Recommended Extras

  • It is good to have a graphical view into what is going on within the docker server. Installing Portainer Community Edition as a container is a good option, allowing interaction through a browser.

  • Given that a database is involved it is also good to have a GUI based SQL tool on hand. BeeKeeper Studio is one option (also available among the snap applications on Ubuntu).


  • This overall exercise reflects lessons learned the hard way by the author - a journey that took time. This route works; however there may be better techniques - it is humbly requested that such wisdom is shared constructively in the comments.

  • You are expected to use this as a kind of template. Use your own project acronym, use later editions of PostgreSQL, PostGIS, Elixir and/ or Phoenix; as you need.

  • If you don't need PostGIS: you can either leave it in or figure out which parts to adjust as you go through.

Discussion (0)