New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code is not reloaded in dev with Docker on OS X #25186

jeromedalbert opened this Issue May 28, 2016 · 12 comments


None yet
10 participants

jeromedalbert commented May 28, 2016

Steps to reproduce

  1. Install the Docker toolbox on OS X. Here are my instructions to install it with brew.
  2. Clone I have created this dummy application specifically for this issue.
  3. Follow the short instructions to set up the project and have a server running.
  4. Open the application in your browser.
  5. While the server is running, edit app/controllers/static_controller.rb and change 'hello world!' to 'coconut'.
  6. Reload the page in your browser.

Expected behavior

The page should display "coconut".

Actual behavior

The page displays the old "hello world!" text.

System configuration

Rails version: 5.0.0.rc1

Ruby version: 2.3.1


To make code reloading work for now, in config/environments/development.rb replace

config.file_watcher = ActiveSupport::EventedFileUpdateChecker


config.file_watcher = ActiveSupport::FileUpdateChecker

Restart everything, and code reloading should work.

Additional comments

I have a feeling that for the ActiveSupport::EventedFileUpdateChecker file watcher, the change event does not occur for docker-machine shared files. So it may be more about docker-machine than Rails. But since I am not versed enough in the EventedFileUpdateChecker internals, I cannot say for sure.

Even if it is docker-machine's fault, since I cannot pinpoint the exact problem, I would not know how to articulate it if I were to open an issue on their github repo. We might also find a workaround in Rails or add a warning the Rails documentation. That's why I am opening this issue here. Any insight would be appreciated.


This comment has been minimized.


gsamokovarov commented May 28, 2016

The docker on OSX runs on a thin Linux virtual machine. The virtual machine provisioners share code between the VM and the host on a file system that doesn't support notification events, so we cannot use the new listener backend on those.


This comment has been minimized.


fxn commented May 28, 2016

What @gsamokovarov said.

Some setups do not work because fs events are not triggered. The generator has some simple code to comment out that configuration line.

Do you think the application generator can detect this particular setup somehow?


This comment has been minimized.


jeremy commented May 28, 2016

Note this will(/should) work with the forthcoming Docker for Mac/Windows that are now in beta. OS X FSEvents are bridged to inotify.


This comment has been minimized.

lnikell commented May 29, 2016

I had the same issue with my HyperV Ubuntu 16.04, any changes at controllers, models not affected until restart server. Only css and changes in views work properly


This comment has been minimized.


fxn commented May 29, 2016

This is something Rails cannot do anything about unless support for detecting this at runtime and hot-switching the monitors is implemented.

Also, you could generate the conservative option always (it was this way when the feature was first implemented). But it was decided to generate the config for the evented monitor by default (mod those simple exceptions linked above) because it is believed that most setups can benefit from it. If the setup does not support it, then you need to opt-out.

I think we can close this one on the basis of not having a bug here, but if you believe Rails could explain this better somewhere please feel free to make a proposal.

@fxn fxn closed this May 29, 2016


This comment has been minimized.

mrkongo commented Aug 21, 2016


Also, you could generate the conservative option always

How to?


This comment has been minimized.


fxn commented Aug 23, 2016

@mrkongo Go to config/environments/development.rb and comment

config.file_watcher = ActiveSupport::EventedFileUpdateChecker

out. If not needed for anything else, you may also want to remove the listen gem dependency in Gemfile.


This comment has been minimized.

krainboltgreene commented Feb 14, 2017

For anyone looking at this, Docker For Mac has other file issues that prevent EventedFile from working. Use File and stick to Docker Toolbox.


This comment has been minimized.

f1nnix commented Jun 22, 2017

FileUpdateChecker fix doesn't work properly on:

  • docker-machine version 0.11.0, build 5b27455
  • Docker version 17.05.0-ce, build 89658be

After change, code is reloaded with ~5 min lag, which makes code reload feature practically useless. Is there any workaround for this?

Thank you.


This comment has been minimized.

krainboltgreene commented Jun 22, 2017

@f1nnix Frankly there never will. You're writing to a file on a computer, that then has to tell some extra file system (Likely vbfs or nfs) of the event, that then has to propagate to the guest machine's filesystem, that then has to report to docker that the file event happened.

Basically, avoid dealing with superhost machine file events.

ztolley added a commit to barnardos/consent-form-builder that referenced this issue Jul 27, 2017

Introduce a new environment for docker to rails
Rails does not play well with docker with due to not supporting events telling ruby a file changed. The docker config tells rails to poll files rather than rely on events.

Tested to not increase CPU usage


knpwrs added a commit to knpwrs/pco-graphql that referenced this issue Aug 13, 2017


This comment has been minimized.

Glutexo commented Feb 20, 2018

For me the EventedFileUpdateChecker does not work even on bare macOS without Docker. Switching to FileUpdateChecker solved the issue.


This comment has been minimized.

krainboltgreene commented Feb 20, 2018

That's sort of a "known issue" with Mac's file watcher. Some things (say, dropbox) can just take complete control, apparently?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment