Johandekoning.nl

Develop Github Pages locally with docker

The official github pages documentation explains how you can test your Github Pages using Jekyll locally. I had a hard time installing all dependencies. A faster and easier way is to use the docker image provided by Jekyll. Make sure you are using the image with the pages tag: jekyll/jekyll:pages.

I use below docker-compose file to start up an docker image with Jekyll which serves the current directory where I cloned my Github pages repository

version: '3'
services:
    github-pages:
      image: jekyll/jekyll:pages
      volumes:
        - .:/srv/jekyll
      ports:
        - 4000:4000
      command: jekyll serve