Docker Compose and Jekyll

I still use Jekyll for this site. It’s still great, write in Markdown, build a static site, host everywhere.

But, my plan is to migrate to Gatsby and MDX pretty soon. But in the meantime, it does the job. Recently i switched to a new computer, and this time I didn’t want to install Ruby since I don’t use it for anything else nowadays. In the past I’ve used Rbenv for managing a local Ruby installation which is great, but i wanted to use Docker Compose this time. I am fine installing Ruby if it’s isolated in a container.

So, lets use Docker Compose to handle the container. The following docker-compose.yml file will do the job.

version: '3'
      image: jekyll/jekyll:3.8
        - JEKYLL_ENV=development
      command: bundle exec jekyll serve --watch --incremental --config _config-dev.yml --host
          - 4000:4000
          - .:/srv/jekyll:cached
          - ./vendor/bundle:/usr/local/bundle:cached

The notes

  • Using the default Jekyll Docker image
  • Using bundler to start Jekyll.
  • Specify a separate config file for development
  • Using cached volumes for performance
  • To make Jekyll available outside localhost, use --host=

✅ Now all we have to do is run docker-compose up -d and head over to http://localhost:4000