We already know how to use Elixir inside Docker so now is time to run Phoenix application as a docker container.

Do you remember our configuration for pure Elixir application? We will need to modify each part a little bit:

Update Dockerfile definition Remove auxiliary bash script Use the default Phoenix mix.exs description Use the default Phoenix your_application.ex entrypoint

Configuration

The first extension to the Dockerfile is the EXPOSE command which informs Docker that the container listens on the specified network ports at runtime.

ENV PORT ${PORT:-4000}

EXPOSE $PORT