Using Elixir with Docker

In order to be able to use Elixir with the help of Docker, so that you can run different containers with different versions, and to have a shared code folder, you could follow the steps below:

  • Install docker in your system. Installation instructions for different systems are here
  • Download the elixir image from the Docker Hub:
    sudo docker pull trenpixster/elixir
  • List the images on your host:
    sudo ps docker images
  • Start a specific version of the elixir docker container (ie elixir 1.0.3):
    sudo docker run -t -i trenpixster/elixir:1.0.3 /bin/bash
  • Use a shared folder with code between the docker container and your host:
    sudo docker run -v /home/user/Prog:/Prog -t -i trenpixster/elixir:1.0.3 /bin/bash

    where the folders after the -v option are /home/user/Prog (host) and /Prog (docker)

  • Use a port forwarding:
    sudo docker run -p 8000 -v /home/user/Prog:/Prog -t -i trenpixster/elixir:1.0.3 /bin/bash