This site is built using jekyll and while that means it has the benefits of most statically generated sites like speed, security, and flexibility, it can be really inconvenient setting it up on a new environment. Jekyll is built using ruby and therefore requires a ruby environment to be set up everytime you’re on a new machine or environment.

Setting up the Ruby environment, debugging missing dependencies, and figuring out why the site runs on one machine and doesn’t run on another can be annoying and kills the momentum of getting the site up and running to begin focusing on the actual content.

Docker is the perfect antidote to having a site or application that is environment-agnostic. In this article, I’ll share the docker-compose.yml file that I use to quickly get started on using the jekyll site.

docker-compose.yml file

version: '3'
services:
  jekyll-serve:
    image: jekyll/jekyll:stable
    volumes:
      - ".:/srv/jekyll"
    ports:
      - 4000:4000 #left: host machine's port number; right: container port number
    command: 'jekyll serve'

Running the site

To run the site, make sure you’re docker-compose file is in the site’s root directory and run:

docker-compose up -d
# The -d flag tells docker to run in detached mode
# That saves you a bunch of logs in your terminal

Github link to docker-compose file: https://github.com/mutsinzi/dc-files/