So you are wanting to keep the container running so that you can exec into it and run commands such as npm run right?.
If that is the case, you just have to set the container to run a command that will stay open to keep the container from exiting. The reason the container is exiting is because you have not specified any command for the container to run when it is started. You should do something like this.
docker-compose.yml:
mix:
build:
context: ./docker/mix
args:
- DOCKER_ENV=${DOCKER_ENV}
container_name: mix
# The std_open and tty settings are to make sure that the `sh` command
# waits for input instead of exiting.
stdin_open: true
tty: true
command: sh # Start `sh` when the container starts to keep container from exiting.
volumes:
- ${PROJECT_PATH}/src:/srv/app
environment:
- DOCKER_ENV=${DOCKER_ENV}
- APP_DEBUG=${APP_DEBUG}