Tony Wolski

Local GitHub Pages in one command (with Docker)

2016-10-13

I wiped and installed macOs Sierra on Macbook Pro on the weekend, something I like to do regularly to hone my reboot procedure with my dotfiles repo. Part of that procedure is to get my blog up and running, which runs on Jekyll and GitHub Pages. I like to edit a blog post locally, and run bundle exec jekyll serve to see how the layout looks locally before I push to GitHub.

When I first installed Jekyll I installed rvm to manage and install Ruby. However I don’t write Ruby code and find it’s overkill to have to install it simply to start my blog. After all, I’m a minimalist, and I only really want to work in a terminal and a browser.

So I decided to try and spin up my Jekyll based GitHub Pages blog on Docker. And it turned out to be a really simple task.

First, I found the official jekyll docker images here. Visiting the wiki brought me to Usage: Running page, and combining the run command with GitHub’s instructions to Build your local Jekyll site:

docker run --rm --label=jekyll --volume=$(pwd):/srv/jekyll -it -p 127.0.0.1:4000:4000 jekyll/jekyll bundle exec jekyll serve

… to my delight, started the blog first time and was accessible at http://localhost:4000.

Awesome. No dependencies to install. Easy to remove from my system. Minimalism at it’s best.


Your thoughts? I'd love to hear them. Please get in contact.