If you are running a static webpage generator that is built by Ruby and Jekyll, chances are you might have faced issues installing gems and configuring the dev environment across various operating systems.

What is Docker and Docker container?

Docker is a platform that makes it simpler to build and ship software across many settings and infrastructures by allowing developers to build, deploy, and operate programs within lightweight, portable containers and images.

Dockerize your Jekyll theme

Create Dockerfile

FROM ruby:3.0

RUN bundle config --global frozen 1

WORKDIR /app/jekyll

COPY Gemfile Gemfile.lock ./

RUN bundle install

Run command docker build -t jekyll . to build a docker image.

Add host to the config.

Add variable host to the _config.yml file.

host: ""

Create Docker compose

version: "3.0"

    image: jekyll
    container_name: app-jekyll-container
    command: [ "jekyll", "serve"]
      - "4000:4000"
      - $PWD:/app/jekyll

Initiate the container by simply using docker-compose up and you have the local server running at

Leave a comment