To run jekyll generated static site with minimal setup and fuss, dockers comes to the rescue. This article is about to setup jekyll in the most easy way so that modification for your blog or site is easy.

Read how to setup jekyll from scratch.

Bootstrap Dockers.

Install Dockers and dockers-compose. The setup are straight forward.

Running Jekyll dockers

Go the directory where your site is and create file name docker-compose.yaml with the following content.

version: '3'

services:
  jekyll:
    container_name: jekyll
    image: jekyll/jekyll
    ports:
      - "4000:4000"
    volumes:
            - ".:/srv/jekyll"
    command: jekyll serve --incremental --force_polling

Description.

  • container_name : The name of the container. You can name anything you like relevant but this name will be use if you want to actually log-in to the docker container.
  • image : The name of the image that need to pull from the dockers hub. This should not change.
  • ports : The port where you want to expose the host to reach your site. Say http://localhost:4000/
  • volumes : This tell to the containe to mount your current directory to the /srv/jekyll so that jekyll serve can find your site.
  • command : The entrypoint comment to run jekyll.

To run the jekyll container.

docker-compose up

If you want to run in background

docker-compose up -d

The site should be reachable at http://localhost:4000/

Should you require to log-in to the container

docker exec -it jekyll bash