title: Play framework auto-loading in docker container
body: <p>I'm trying to set up a development environment for developing a play application in a docker container. I have created an image with sbt installed. I then map the project folder on my host to the container as a volume and run shell in interactive mode:</p>
  
  <pre><code>docker run -v /Users/jorgen/dev/play-sbt-docker/app:/data/app -w /data/app -p 9999:9000 -i -t jorgenfb/sbt /bin/bash
  </code></pre>
  
  <p>I then starts the play application by running <code>sbt ~run</code>. The play server starts just find, it even recompiles when i edit my files on the host: </p>
  
  <pre><code>[info] Compiling 1 Scala source to /data/app/target/scala-2.10/classes...
  [success] Compiled in 2s
  </code></pre>
  
  <p>The problem is that the changes does not appear in the browser when I refresh. There is no caching issue since I have disabled caching. If I run the application from my host, everything works fine.</p>
  
  <p>Edit:
  This is my Dockerfile used to create the container with sbt:</p>
  
  <pre><code>FROM dockerfile/java:oracle-java8
  MAINTAINER  Jørgen Borgesen
  
  ENV SBT_VERSION 0.13.5
  
  # Install sbt
  RUN cd /tmp &amp;&amp; \
      wget https://dl.bintray.com/sbt/native-packages/sbt/$SBT_VERSION/sbt-$SBT_VERSION.zip &amp;&amp; \
      unzip sbt-$SBT_VERSION.zip -d /usr/local &amp;&amp; \
      rm sbt-$SBT_VERSION.zip
  </code></pre>
  
  <p>I did some more research. Inside the docker container i start the play application like this:</p>
  
  <pre><code>[ root@aa1f2327d938:/data/app ]$ /usr/local/sbt/bin/sbt
  [info] Loading project definition from /data/app/project
  [info] Set current project to my-first-app (in build file:/data/app/)
  [my-first-app] $ ~run
  
  --- (Running the application from SBT, auto-reloading is enabled) ---
  
  [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
  
  (Server started, use Ctrl+D to stop and go back to the console...)
  
  [success] Compiled in 740ms
  </code></pre>
  
  <p>Loading the page in my browser works fine. I then change my index file on the host. This triggers recompile inside the container:</p>
  
  <pre><code>[info] Compiling 1 Scala source to /data/app/target/scala-2.10/classes...
  [success] Compiled in 1s
  </code></pre>
  
  <p>Refreshing my browser still shows the initial index file. Even if the changes was picket up by the play application inside the container. I have also inspected the compiled files in <code>target/scala-2.10/classes/views/html</code> (on my host, since I'm running the play application in the container and I'm not sure how to attach multiple terminals to it). The compiled files has changed.</p>
  
  <p>The next thing I did was pressing Ctrl-D. This should take my back to the sbt console according the printed message above "(Server started, use Ctrl+D to stop and go back to the console...)". However this results in the following output:</p>
  
  <pre><code>[success] Total time: 455 s, completed Sep 25, 2014 7:40:35 AM
  1. Waiting for source changes... (press enter to interrupt)
  
  --- (Running the application from SBT, auto-reloading is enabled) ---
  
  [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
  
  (Server started, use Ctrl+D to stop and go back to the console...)
  
  [info] play - Application started (Dev)
  </code></pre>
  
  <p>Now the changes I made earlier are reflected in the browser after a refresh.</p>