Jekyll Docker Compose (2025)

  Sep 23, 2025      2m      0   
 

Set up Jekyll v4.4.1 using Docker Compose

Jekyll Docker Compose (2025)

Prerequisites

Docker Compose for Jekyll

Docker Image: minhng/jekyll

  • Latest official Ruby image: ruby:3.4.6-trixie
  • Jekyll v4.4.1
  • Bundler v2.7.2
  • System utilities: git, curl, ssh, nano, htop, wget, unzip

docker-compose.yml

version: "3.9"
services:
  jekyll:
    image: minhng/jekyll:4.4.1
    container_name: jekyll_server    
    # Mount your Jekyll project
    volumes:
      - ./myblog:/srv/jekyll
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro    
    working_dir: /srv/jekyll    
    # Run Jekyll server
    command: >
      bash -c "bundle install --gemfile=Gemfile &&
               jekyll serve --host 0.0.0.0 --port 4000 --watch"    
    ports:
      - "4000:4000"    
    restart: unless-stopped

Modification if needed:

  • Change ./myblog to your Jekyll project folder
  • Change minhng/jekyll:4.4.1 to your Jekyll image if you have built your own image
  • Change jekyll serve --host 0.0.0.0 --port 4000 --watch to your Jekyll command
  • Change 4000:4000 to your port mapping

Usage

  • Put your Jekyll project in myblog folder and run docker-compose up -d to start Jekyll server.
  • Open browser and go to http://localhost:4000 to view your Jekyll site.