Not able to start docker container


am trying to start my elixir application using docker, but the container shuts down as I start it. What am i doing wrong?


FROM elixir:latest

RUN mkdir /app
COPY . /app

RUN mix local.hex --force
RUN mix deps.get

RUN mix do compile

Then I build a docker image using

docker build -t myapp:latest .

Now running the container

docker run --name myapp myapp:latest

The container starts and shutdowns instantly. Is there a way that the container should keep running and i can access the container using this command

docker exec -it myapp bash


So, if anyone interested i fixed it using

docker run -it worm bash 

it directly runs the image in bash

You could also use the -d option, which runs the container in daemon mode (runs in the background and keeps it alive). It will allow you to run it without attaching to it on start, while still be able to do it later.