To test your Jekyll site locally, run the jrun script:
./jrun
This will start the Jekyll development server with Docker.
jrun Doesn’t WorkIf the script doesn’t work, you can run the Docker command directly:
docker run --rm \
-v "$PWD":/srv/jekyll \
-p 4000:4000 \
jekyll/jekyll:pages \
sh -c "apk add --no-cache build-base && bundle install && bundle exec jekyll serve --watch --drafts --force_polling --host 0.0.0.0"
--rm: Automatically removes the container when it stops-v "$PWD":/srv/jekyll: Mounts your current directory into the container-p 4000:4000: Maps port 4000 from container to your hostjekyll/jekyll:pages: Uses the GitHub Pages-compatible Jekyll image--watch: Automatically regenerates the site when files change--drafts: Includes draft posts in the build--force_polling: Forces file watching (useful in Docker)--host 0.0.0.0: Makes the server accessible from outside the containerOnce the server starts, open your browser and navigate to:
http://localhost:4000
Press Ctrl + C in the terminal to stop the Jekyll server.
Issue: “docker: command not found”
Issue: Port 4000 already in use
-p 4001:4000 (then use http://localhost:4001)Issue: Changes not showing
--watch flag is working (you should see regeneration messages)