Running Jekyll GitHub Pages on Windows using Docker
When I first started this blog, I went through the process of setting up Jekyll locally on my Mac so that I could preview posts.
Recently I’ve been doing more work in Windows and wanted to be able to work on my blog without booting up my Mac.
My friend James pointed out on his blog jamessturtevant.com that it’s really easy to get Jekyll running on Windows using Docker so I thought I’d give it a try.
Here are the steps I took based on James advice:
Install Docker for Windows
See instructions here:
Docker for Windows
Checkout Blog Source
Check out the blog source code to C:\Code
PS C:\> git clone https://github.com/fhilton/fhilton.github.io.git C:\Code\
Run Jekyll
Run the following command
PS C:\> docker run -it -p 4000:4000 -v C:/Code/fhilton.github.io:/site itzg/jekyll-github-pages
Which produces the following output
Configuration file: /site/_config.yml
Source: /site
Destination: /site/_site
Generating…
done.
Auto-regeneration: disabled. Use –watch
Configuration file: /site/_config.yml
Server address: http://0.0.0.0:4000/
Server running… press ctrl-c to stop.
The above command tells docker to
- run the itzg/jekyll-github-pages image
- bind /site in the image to C:\Code\fhilton.github.io
- bind port 4000 of our docker host to port 4000 of the container
Browse Away!
Next browse to http://localhost:4000 and the blog is served!