On , I learnt ...

How to run Jekyll in a Docker container

To run the server, run:

docker run --rm \
    --volume="${PWD}:/srv/jekyll" \
    -p 4000:4000 \
    -it jekyll/jekyll:3.8 \
    jekyll serve --incremental

This will install your Gemfile.lock dependencies and run the local server on port 4000.

If your Jekyll site is published using Github Pages, you can pin your jekyll and gh-pages versions to those used by Github. Having said that, there is no v3.9.0 of jekyll/jekyll on the Docker Hub so it’s best to use v3.8 for now.