./databyte


Docker is great, slow Rails apps is not

It’s apparently a known issue to have slow Rails apps under Docker in development due to folder sharing in VirtualBox.

There are many suggestions as to how to fix this, so I tried a few.

rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(453) [sender=2.6.9]
error: exit status 12
Watching for file changes ...

Maybe this magic bullet shit won’t work, let’s try using an image as part of compose so that we’re more explicit about this syncing process.

  • Looks like docker-unison works to sync files and it syncs them quickly but the application still takes 20 seconds to load a simple page.
  • dinghy created a VM as a wrapper to docker-machine and no luck with that too.

Other NFS scripting options:

Since I have Fusion installed though, this seems like a lot of work to just get a basic Rails app to run.

My solution:

  • Use Docker for everything not Rails or Guard. Postgres and workers seem fast enough.
  • Run Rails locally with your standard gem install bundler; bundle.
  • Leave the app running in Docker Compose if I need to check out anything in Linux but avoid it at all costs.

I’ve got too much real work to do.