Run jekyll in docker fails on macbook with M3 chip

Hi everyone.

After migrating to new macbook with M3 chip I realized that jekyll fails run in Docker with error.

chown: _site: Permission denied

Here is my docker run command.

JEKYLL_VERSION=4.2.2

docker run --rm \
	  --volume=$(PWD):/srv/jekyll \
	  -p 4000:4000 \
	  -it jekyll/jekyll:$(JEKYLL_VERSION) \
	  jekyll serve --livereload

Do anybody now how I can fix it?

you could try manually deleting the _site directory and re-running docker. Possibly the migration left _site with odd permissions.

I see a few issues that are likely culprits:

  1. A common mistake is to open a terminal window and type the Docker command. You must create a folder where you can grant Docker access. For example, before you run any Jekyll commands, run a terminal window and type:
cd desktop
mkdir test-site
cd test-site
[leave this terminal window open and then run the rest of the Jekyll commands]
  1. You need to set the JEKYLL_VERSION using export
  2. Ruby removed a core component that Jekyll requires, called webrick. That particular Docker container does not include Webrick, so it will not run unless you add it. Below is the updated code that ran just fine on my MacBook Pro M1:
export JEKYLL_VERSION=4.2.2

docker run --rm \
  --volume=$(pwd):/srv/jekyll \
  -p 4000:4000 \
  -it jekyll/jekyll:$JEKYLL_VERSION \
  /bin/bash -c "gem install webrick && jekyll serve --livereload"

Please note a few details:

  1. Jekyll will tell you it is running at http://0.0.0.0:4000. However, the web address is https://127.0.0.1:4000 or https://localhost:4000
  2. If you do not already have a Jekyll site in your folder, there won’t be much to look at because, by default, the container you used does not create a Jekyll site.
  3. That Jekyll image uses amd64, similar to Intel chipsets. It will run, but be aware it will use Apple’s Rosetta technology for backward compatibility. There is no guarantee Apple will keep that around, and if Apple removes it, it is doubtful that your Docker container will continue running. It is better to use a Linux image that is ARM compatible, given that is the architecture Apple uses for its M-series (Apple Silicon) chips.

To address #3 above, some work is required, but you can create your own Docker image using an ARM-compatible version of LINUX, like Ubuntu. Below is a video I created, and here is the gist with all the instructions if you are more of a reading type. Alternatively, you could find another Jekyll image that supports ARM.