Docker Container For Jekyll
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
- Install Docker
- A Jekyll website or clone the minimal mistakes or this Jekyll sites.
Running the Jekyll Container
- Open a powershell or terminal window
- Navigate to your Jekyll website directory
- 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
- 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
- Wait for gem files and Jekyll to build the website
- Open your browser to http://localhost:4000
- 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.