卷的WSL2 Docker Linux权限问题



我正在使用Docker来构建Jekyll网站。我正在与Debian一起使用Windows 10和WSL2。如果我在Windows环境中从Powershell运行以下程序

docker run --rm --label=jekyll --volume=C:/_projects/site/theme:/srv/jekyll -it -p 4000:4000 jekyll/jekyll jekyll serve

如果尝试通过WSL2 从我的Debian shell运行这个

docker run --rm --label=jekyll --volume=/mnt/c/_projects/site/theme:/srv/jekyll -it -p 4000:4000 jekyll/jekyll jekyll serve

然后我得到一个错误:-

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)

我的直觉是,我遇到了Linux文件权限问题,但我不知道如何解决它,也不知道我的假设是否正确。

我必须编辑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"

如中所述https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly#ensure-卷装载工作

感谢@NotTheDr01ds

相关内容

  • 没有找到相关文章

最新更新