Live reload not working #40

Closed
opened 2025-11-20 04:15:10 -05:00 by saavagebueno · 2 comments
Owner

Originally created by @EDIflyer on GitHub (Jan 12, 2024).

First of all, thank you so much for creating this container - the main jekyll one kept refusing to build for me with EOF errors, broken pipes, etc.

Building the site works OK with your version but I've found live reload doesn't seem to work.

If I used this compose:

services:                           # Configs for the various services, we just have one
  jekyll:
    image: bretfisher/jekyll-serve     # Image name to pull from Docker Hub
    ports:
      - 4000:4000                   # Map local port 4000 to port 4000 in the container
      - 35729:35729                 # We need to specify another port for the Jekyll 3.70+ live reload feature
    volumes:
      - /mnt/c/Users/ediflyer/Documents/Repositories/oshw-tools:/site           # Mount a volume so the container can access local data in the src directory

Then I get:
image

If I click on the link it doesn't work but if I change to http://localhost:4000 in my browser it works fine. Port 35729 doesn't work but I think that's as expected as live-reload not specified??

However if I use this compose:

services:                           # Configs for the various services, we just have one
  jekyll:
    image: bretfisher/jekyll-serve     # Image name to pull from Docker Hub
    command: jekyll serve --livereload     # Command to run when the container starts
    ports:
      - 4000:4000                   # Map local port 4000 to port 4000 in the container
      - 35729:35729                 # We need to specify another port for the Jekyll 3.70+ live reload feature
    volumes:
      - /mnt/c/Users/ediflyer/Documents/Repositories/oshw-tools:/site           # Mount a volume so the container can access local data in the src directory

I get this:
image

I see it now includes both ports and seems to have switched from 0.0.0.0 to 127.0.0.1 however neither of those then work (in either localhost or 127.0.0.1 variety - I just get no data served:
image

Should I be triggering livereload differently? Is there an issue with the command?

Originally created by @EDIflyer on GitHub (Jan 12, 2024). First of all, thank you *so much* for creating this container - the main `jekyll` one kept refusing to build for me with EOF errors, broken pipes, etc. Building the site works OK with your version but I've found live reload doesn't seem to work. If I used this compose: ``` yml services: # Configs for the various services, we just have one jekyll: image: bretfisher/jekyll-serve # Image name to pull from Docker Hub ports: - 4000:4000 # Map local port 4000 to port 4000 in the container - 35729:35729 # We need to specify another port for the Jekyll 3.70+ live reload feature volumes: - /mnt/c/Users/ediflyer/Documents/Repositories/oshw-tools:/site # Mount a volume so the container can access local data in the src directory ``` Then I get: ![image](https://github.com/BretFisher/jekyll-serve/assets/13610277/cb34f842-1acd-4318-99ee-c83c736385db) If I click on the link it doesn't work but if I change to `http://localhost:4000` in my browser it works fine. Port `35729` doesn't work but I think that's as expected as live-reload not specified?? However if I use this compose: ``` yml services: # Configs for the various services, we just have one jekyll: image: bretfisher/jekyll-serve # Image name to pull from Docker Hub command: jekyll serve --livereload # Command to run when the container starts ports: - 4000:4000 # Map local port 4000 to port 4000 in the container - 35729:35729 # We need to specify another port for the Jekyll 3.70+ live reload feature volumes: - /mnt/c/Users/ediflyer/Documents/Repositories/oshw-tools:/site # Mount a volume so the container can access local data in the src directory ``` I get this: ![image](https://github.com/BretFisher/jekyll-serve/assets/13610277/41d6d5c6-f9ce-4a2a-8adc-3a48e2a2e207) I see it now includes both ports and seems to have switched from `0.0.0.0` to `127.0.0.1` however neither of those then work (in either `localhost` or `127.0.0.1` variety - I just get no data served: ![image](https://github.com/BretFisher/jekyll-serve/assets/13610277/ae64d7ea-5140-41c7-986d-b9b749b786a9) Should I be triggering livereload differently? Is there an issue with the command?
Author
Owner

@BretFisher commented on GitHub (Jan 20, 2024):

I'll assume you're using this with Docker Desktop for Windows in WSL2. If that's true, I don't think file watching works across OS file systems. The way livereload works is the binary (jekyll) uses the Linux file I/O API to know when files change. That doesn't work when the files are living on the Windows file system.
Like Docker's Docs, I recommend you always keep your source code in the Linux file system, and that way you get native file I/O performance (gem installs will be faster) and livereload should work. Editors like VS Code work with files in the Linux file system. VS Code has an extension for it.

@BretFisher commented on GitHub (Jan 20, 2024): I'll assume you're using this with Docker Desktop for Windows in WSL2. If that's true, I don't think file watching works across OS file systems. The way livereload works is the binary (jekyll) uses the Linux file I/O API to know when files change. That doesn't work when the files are living on the Windows file system. Like Docker's Docs, I recommend you always keep your source code in the Linux file system, and that way you get native file I/O performance (gem installs will be faster) and livereload should work. Editors like VS Code work with files in the Linux file system. VS Code [has an extension for it](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack).
Author
Owner

@EDIflyer commented on GitHub (Jan 20, 2024):

Ah interesting, thanks @BretFisher

@EDIflyer commented on GitHub (Jan 20, 2024): Ah interesting, thanks @BretFisher
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jekyll-serve#40