jekyll docker image with imagemagick6 instead of imagemagick7


If you are using Jekyll under macOS, several issues might be happening right now:

  1. Something is broken under Big Sur.
  2. HomeBrew installs Ruby 3.x.x, for which something is not ready yet.
  3. A plugin requires ImageMagik6 or RMagick (like the excellent wildlyinaccurate/jekyll-responsive-image.

Issues 2 and 3 might even happen if you are using GNU/Linux, by the way.

After several downgrade and upgrade tries, I got sick of trying to brew and rvm the issue. I moved to Docker to avoid these issues, too.

Luckily, there is jekyll-docker for this. This is a wonderful image. It even allows you to add Alpine Linux packages to it by specifying their name in a .apk file. This fixes issue 1 and issue 2.

Unfortunately, jekyll-docker does not fix issue 3 because it installs ImageMagick7 by default. Using it as-is will result in the following error:

ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux-musl]
Configuration file: /srv/jekyll/_config.yml
 Theme Config file: /usr/gem/gems/no-style-please-0.1.0/_config.yml
            Source: /srv/jekyll
       Destination: /srv/jekyll/_site
 Incremental build: disabled. Enable with --incremental
       Jekyll Feed: Generating feed for posts
  Liquid Exception: NoDecodeDelegateForThisImageFormat `JPEG' @ error/constitute.c/ReadImage/562 in /srv/jekyll/_posts/
      Jekyll 4.1.1   Please append `--trace` to the `build` command
                     for any additional information or backtrace.
Traceback (most recent call last):


/usr/gem/gems/jekyll-responsive-image-1.5.5/lib/jekyll-responsive-image/image_processor.rb:12:in `read': NoDecodeDelegateForThisImageFormat `JPEG' @ error/constitute.c/ReadImage/562 (Magick::ImageMagickError)

You can’t just install ImageMagick6 as it will conflict with ImageMagick7. Do not despair! The fix is actually simple. We extend jekyll/jekyll to use ImageMagick6 instead of ImageMagic7.

Create a Dockerfile with just the following content1:

# jekyll-docker, but with ImageMagick6 instead of ImageMagic7.

FROM jekyll/jekyll:stable

LABEL maintainer="Daniel Graziotin, [email protected]"

RUN apk --no-cache del imagemagick-dev \
    && apk --no-cache add imagemagick6-dev

Build your image with the following command:

docker build . -t dgraziotin/jekyll-imagemagick6:stable

You can target any Jekyll version as available on Docker Hub, just replace the instances of the word stable in the Dockerfile and the build command with the tag of interest.

Run your new image with the following command:

/usr/bin/env docker run --rm \
  --volume="$PWD:/srv/jekyll" \
  -it dgraziotin/jekyll-imagemagick6:stable \
  jekyll build

And that is it! You can serve your Jekyll site locally with:

/usr/bin/env docker run --rm \
  --volume="$PWD:/srv/jekyll" \
  -p 4000:4000 \
  -it dgraziotin/jekyll-imagemagick6:stable \
  jekyll serve

The site will be reachable at

Hope you’ll find it useful!

  1. Alternatively, pull mine with docker pull dgraziotin/jekyll-imagemagick6:stable and just run it. 

I do not use a commenting system anymore, but I would be glad to read your feedback. Feel free to contact me.