Search code examples
playframeworkdockerfig

Keeping a Play framework app running in a Docker container without a pseudo-TTY


I have a development setup where I need multiple containers running different services, and I'm trying to use Fig to achieve this. Everything else works fine, but one of these services is a Play Framework app, and it does not want to stay running unless it gets a pseudo-TTY. This would be fine and good, but since I want to coordinate these multiple containers, I want to fig up, and that command does not seem to allocate pseudo-TTY's, so the process dies immediately after startup, and all the containers along with it.

I've created a repository with a showcase of this problem that anybody can just clone and run, the instructions are in the README. If anybody can shed any light on how to create e.g. a middleman script that would keep the app running, or really any other solution where I could fig up my linked container setup, that'd be brilliant.

Alternatively, if anybody is using any other methods of coordinating multiple containers like this, like maybe a nice shell script runner that manages things, I welcome your insight.

edit: I changed the accepted answer because the new one actually solves the problem. The workaround answer still has valuable info, though.


Solution

  • Fig has been replaced by Docker Compose, and in your docker-compose.yml file you can now add the stdin_open: true setting, which should fix this issue:

    web:  
      image: brikis98/ping-play
      ports:
        - "9000:9000"
      stdin_open: true
    

    In the example above, the brikis98/ping-play image is a Play app that executes activator run by default. If I run docker-compose up on the YAML file above, the Play app boots up and keeps running instead of exiting immediately.