Container with Phoenix App gets Killed within a minute

Expected behavior

Docker container starts the Phoenix server and serves a static HTML file at localhost:4000

Actual behavior

Docker container starts and does serve the file correctly, but it gets Killed within a minute or so. This happens regardless of activity.

Steps to reproduce the behavior

  1. mix --no-brunch --no-ecto hello_phoenix
  2. cd hello_phoenix
  3. (Copy Dockerfile)
  4. docker build -t hello_phoenix .
  5. docker run -p 4000:4000 hello_phoenix

docker inspect (container name) shows me that the process exits with a 137 error code. If you add a -m flag to the run command, you can adjust how long it takes for it to crash. What is odd is that if, for example, you do -m=3g, the container will exit with “OOMKill” set to true even though no process actually approaches 3GB of memory in the process explorer. This all makes me think there’s an issue with the Phoenix app, but it runs with no issue on my machine. Here’s the Dockerfile I’ve written:

FROM marcelocg/phoenix
RUN echo $PWD
#Copy source
ADD . ./
#Get dependencies
RUN yes | mix local.hex
RUN yes | mix deps.get
RUN yes | mix compile
RUN ls -l
#Run server
ENTRYPOINT yes | MIX_ENV=dev mix phoenix.server

Is there any more info that would be helpful?

Found the problem: With Elixir/Erlang, using the “yes |” in the entrypoint causes it to buffer an infinite string of yeses until the process is killed by the host.