Issue
I am using Docker to build Jekyll web sites. I am using Windows 10 and WSL2 with Debian. If I run the following from Powershell in my Windows Environment
docker run --rm --label=jekyll --volume=C:/_projects/site/theme:/srv/jekyll -it -p 4000:4000 jekyll/jekyll jekyll serve
If try and run this from my Debian shell via WSL2
docker run --rm --label=jekyll --volume=/mnt/c/_projects/site/theme:/srv/jekyll -it -p 4000:4000 jekyll/jekyll jekyll serve
Then I get an error:-
Configuration file: /srv/jekyll/_config.yml
Source: /srv/jekyll
Destination: /srv/jekyll/_site
Incremental build: disabled. Enable with --incremental
Generating...
jekyll 3.8.5 | Error: Operation not permitted @ apply2files - /srv/jekyll/_site/assets/css/font-awesome.css
Traceback (most recent call last):
25: from /usr/local/bundle/bin/jekyll:29:in `<main>'
24: from /usr/local/bundle/bin/jekyll:29:in `load'
23: from /usr/gem/gems/jekyll-3.8.5/exe/jekyll:15:in `<top (required)>'
22: from /usr/gem/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
21: from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
20: from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
19: from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
18: from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
17: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
16: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/commands/serve.rb:93:in `start'
15: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/commands/serve.rb:93:in `each'
14: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/commands/serve.rb:93:in `block in start'
13: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/commands/build.rb:36:in `process'
12: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/commands/build.rb:65:in `build'
11: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/command.rb:28:in `process_site'
10: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/site.rb:73:in `process'
9: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/site.rb:208:in `write'
8: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/site.rb:330:in `each_site_file'
7: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/site.rb:330:in `each'
6: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/site.rb:331:in `block in each_site_file'
5: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/site.rb:331:in `each'
4: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/site.rb:332:in `block (2 levels) in each_site_file'
3: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/site.rb:209:in `block in write'
2: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/static_file.rb:105:in `write'
1: from /usr/gem/gems/jekyll-3.8.5/lib/jekyll/static_file.rb:163:in `copy_file'
/usr/gem/gems/jekyll-3.8.5/lib/jekyll/static_file.rb:163:in `utime': Operation not permitted @ apply2files - /srv/jekyll/_site/assets/css/font-awesome.css (Errno::EPERM)
My instinct is that I am bumping into Linux file permission issue, but I have no idea how to resolve it, or if my hypothesis is correct.
Solution
I had to edit wsl.conf
sudo nano /etc/wsl.conf
# Now make it look like this and save the file when you're done:
[automount]
root = /
options = "metadata"
As outlined in https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly#ensure-volume-mounts-work
Thanks to @NotTheDr01ds
Answered By - baynezy