1

I am quite new to play and scala and I am facing a small problem. I setup docker based VM with scala (and everything else). My code is sared through the volume. When I run

sbt ~run

the first time, everything getting compiled and working. However, when I make any code changes, the log shows that the code is getting recompiled, but I don't see any changes in the app I am working on. If I restart the 'sbt' completely, the changes getting through.

What could be a reason for this? I made sure that I am running only one instance of 'sbt':

# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.3  48828  6900 ?        Ss   17:16   0:01 /usr/bin/python /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
root         8  0.0  0.1  19752  2792 ?        Ss   17:18   0:00 bash
root        23  0.0  0.1  47588  2648 ?        S    17:21   0:00 sudo su
root        24  0.0  0.1  48204  2288 ?        S    17:21   0:00 su
root        25  0.0  0.1  19748  3196 ?        S    17:21   0:00 bash
root      9231  0.0  0.1  11384  3236 ?        S+   19:26   0:00 bash /usr/bin/sbt ~run
root      9286 36.2 31.6 3009020 649292 ?      Sl+  19:26   4:48 java -Xms1024m -Xmx1024m -XX:ReservedCodeCacheSize=128m -XX:MaxMetaspaceSize=256m -jar /usr/share/sbt-launcher-packaging/bin/sbt-launch.jar ~run
root      9351  0.0  0.1  19752  3616 ?        Ss   19:26   0:00 bash
root     11101  0.0  0.1  17172  2492 ?        R+   19:39   0:00 ps aux

I can't think about anything else

Thanks,

Seth Tisue
  • 29,985
  • 11
  • 82
  • 149
Shurik Agulyansky
  • 2,607
  • 2
  • 34
  • 76
  • which os are you using and the exact sharing conf would be useful ? (also beware that sbt does *a lot* of I/O. volume sharing can be really slow on some systems) – Jean Dec 10 '15 at 21:21

1 Answers1

1

Sbt uses JNotify to monitor the file system. Most likely, your docker based Sbt cannot see the inotify events (see here and the docker issue).

The other common way to share data between an host and a docker container is NFS, unfortunately it doesn't support inotify either at least if the NFS server is on the host machine, the docker machine will not see the changes.

I guess you could try having an NFS server on the docker container and connect to that from the host. Then the docker container might see the file modifications.

Another possible option is to rsync the changes over the network as described in the docker issue.

--- Edit ---

Docker 4 Mac uses a special FS which transmits notify events from the host to the container. it is in private beta at the moment but will hopefully be available shortly.

Community
  • 1
  • 1
Jean
  • 21,329
  • 5
  • 46
  • 64
  • Regarding your first statement, as I mentioned, the compiler runs when I change the code. The problem is that the running application continues running as is. I solved this problem for now through samba share. It works but creates some inconveniences. – Shurik Agulyansky Dec 11 '15 at 00:08