jekyll-docker icon indicating copy to clipboard operation
jekyll-docker copied to clipboard

file changes on host system not picked up by `jekyll serve --watch`

Open jimklo opened this issue 5 years ago • 2 comments

I have a fairly simple docker-compose.yml file:

version: "3.0"

services:
  dev:
    image: jekyll/builder
    command: ["jekyll", "serve", "--incremental", "--watch", "--verbose" ]
    ports: 
      - "4000:4000"
    volumes: 
      - $PWD:/srv/jekyll
      - $PWD/vendor/bundle:/usr/local/bundle

As I'm currently using Windows 10, I also have a .env file that defines PWD=c:\source\website.

Running docker-compose up works as expected, however any changes to files made on the host that should trigger a recompile don't work. It's unclear if this is a docker, jekyll, or jekyll-docker issue - however since it seems the most productive use case of jekyll-docker is it's use as easily portable dev environment. If I exec a bash shell inside the container and touch a modified file, the recompile is triggered.

jimklo avatar Jun 26 '20 23:06 jimklo

I have found a solution. When using jekyll serve one should use --force_polling option. This uses a polling architecture instead of inotify. The inotify solution is known to have issues with Docker bind mounts.

I'd recommend that the documentation for jekyll-docker be updated to reflect this as it's likely not something that will be fixed.

jimklo avatar Jun 29 '20 19:06 jimklo

This is a pretty well known issue with Jekyll, and Docker on Windows. I'm not against adding it, but I don't know how you're using Docker or Windows to even begin to tell people "it's broken in this situation" so if you can provide more info so I can test it, and then document it, that would be great,

envygeeks avatar Jun 30 '20 06:06 envygeeks