I run this blog on Github Pages. In the past, when writing posts, I’ve previewed my blog by installing Ruby through RVM and then doing the good old bundle exec jekyll serve dance.

Github Pages

However, I recently reinstalled Ubuntu, and I didn’t have Ruby. I’ve been using Docker a lot at work, and decided that this would be the perfect way to avoid having to set up Ruby again. Turns out someone’s already done the work of making a Github Pages Docker image and it can be run in one line:

docker run --rm -v $PWD/..:/usr/src/app -p 4000:4000 starefossen/github-pages:latest \
  bundle exec jekyll serve --config _config.yml --host 0.0.0.0

It’s especially important to note the --host 0.0.0.0 part. Without it, you won’t be able to access the running Jekyll server on localhost:4000.

I’ll never install Ruby again*!

* Unless, of course, I need to.