envygeeks / jekyll-docker

⛴ Docker images, and CI builders for Jekyll.
ISC License
992 stars 279 forks source link

Add docs for rootless container support #318

Open littlebenlittle opened 3 years ago

littlebenlittle commented 3 years ago

When using docker, jekyll appears to do some lifting in order to ensure that file permissions work out. However this causes issues when using rootless containers such as those created by podman. Owner and group end up being mapped to ids that don't exist on the host. I tried setting the JEYKLL_UID and JEKYLL_GID variables to 0, but this does not seem to work.

podman run -ti --rm -v .:/srv/jekyll -e JEYKLL_UID=0 -e JEKYLL_GID=0 docker.io/jekyll/jekyll jekyll new .

results in

/usr/local/lib/ruby/2.7.0/fileutils.rb:250:in `mkdir': Permission denied @ dir_s_mkdir - /srv/jekyll/.jekyll-cache (Errno::EACCES)
littlebenlittle commented 3 years ago

There's an undocumented env var JEKYLL_ROOTLESS that seems to do the same thing as setting JEYKLL_UID=0 and JEKYLL_GID=0.

The following works

podman run -ti --rm -v .:/srv/jekyll -e JEKYLL_ROOTLESS=1 docker.io/jekyll/jekyll jekyll new .
mpetuska commented 2 years ago

Unfortunately doesn't work with the latest image. I can confirm that it does work with 4.2.0 image though.