Loading...

Jekyll is a static website generator that converts markdown to html. Jekyll is developed using Ruby and can be challenging to install required components.

Welcome Docker!

Docker is a cross platform tool that allows applications to be run in an isolated environment called containers similar to a VM. Containers are much smaller and less cpu and memory intensive than VM’s.

The official Jekyll container comes setup with everything required to run Jekyll.

Requirements

  1. Install Docker
  2. A Jekyll website or clone the minimal mistakes or this Jekyll sites.

Running the Jekyll Container

  1. Open a powershell or terminal window
  2. Navigate to your Jekyll website directory
  3. Run command for Windows powershell
docker run --rm --volume="$PWD":/srv/jekyll -it -p 4000:4000 -e JEKYLL_ENV=dev `
jekyll/jekyll:pages jekyll s --config _config.yml,_config.dev.yml --force_polling
  1. Run command for OSX/Linux terminal
docker run --rm --volume=$(pwd):/srv/jekyll -it -p 4000:4000 `
jekyll/jekyll jekyll s --config _config.yml,_config.dev.yml
  1. Wait for gem files and Jekyll to build the website
  2. Open your browser to http://localhost:4000
  3. Done

Notes

  • A _config.dev.yml is used to override the Jekyll url parameter to http://localhost:4000
  • OSX or Linux JEKYLL_ENV or force_polling parameters are not required.

Author: David Wong @ World Warrior

Permalink: http://localhost:4321/blog/2017-05-09-docker-container-for-jekyll/

Title: Using Docker Container for Jekyll Development

License: All articles on this blog are licensed under the BY-NC-SA license agreement unless otherwise stated. Please indicate the source when reprinting!