asciidoctor / docker-asciidoctor

:ship: A Docker image for using the Asciidoctor toolchain to process AsciiDoc content
https://hub.docker.com/r/asciidoctor/docker-asciidoctor/
Other
321 stars 151 forks source link

Permission denied @ rb_file_s_stat with podman #443

Closed timo-a closed 2 months ago

timo-a commented 2 months ago

As I try to execute the podman commands as instructed in the Readme I get permission denied:

$ podman run -it -v /home/me/folder/where/my/file/is:/documents/ docker.io/asciidoctor/docker-asciidoctor
Trying to pull docker.io/asciidoctor/docker-asciidoctor:latest...
Getting image source signatures
Copying blob 22a92847a6e9 done   | 
Copying blob 4abcf2066143 done   | 
Copying blob bafd83565e15 done   | 
Copying blob 24dca545b8ad done   | 
Copying blob d85d04c61e34 done   | 
Copying blob 332b907bbec4 done   | 
Copying blob 9a8aa23700ed done   | 
Copying blob 861fa47081ee done   | 
Copying blob 4f4fb700ef54 done   | 
Copying blob 5ec0dbf08600 done   | 
Copying config effb12a88d done   | 
Writing manifest to image destination
50f460ed6238:/documents# asciidoctor myfile.adoc
/usr/lib/ruby/gems/3.2.0/gems/asciidoctor-2.0.22/lib/asciidoctor/cli/options.rb:238:in `stat': Permission denied @ rb_file_s_stat - skript.adoc (Errno::EACCES)
    from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-2.0.22/lib/asciidoctor/cli/options.rb:238:in `block in parse!'
    from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-2.0.22/lib/asciidoctor/cli/options.rb:236:in `each'
    from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-2.0.22/lib/asciidoctor/cli/options.rb:236:in `parse!'
    from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-2.0.22/lib/asciidoctor/cli/options.rb:34:in `parse!'
    from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-2.0.22/lib/asciidoctor/cli/invoker.rb:24:in `initialize'
    from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-2.0.22/bin/asciidoctor:13:in `new'
    from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-2.0.22/bin/asciidoctor:13:in `<top (required)>'
    from /usr/bin/asciidoctor:25:in `load'
    from /usr/bin/asciidoctor:25:in `<main>'

In fact it seems I can't do anything in this shell: ls gives ls: can't open '.': Permission denied, sudo is not found and su doesn't do anything other than removing the containers hash from the prompt.

I tried putting sudo in front of the podman command but it did not make a difference. I tried adding -u $(id -u):$(id -g) to the arguments, but that did not make a difference either.

mojavelinux commented 2 months ago

When mapping the volume, I'm pretty sure you need to append either :z or :Z to the mapping in order for the user IDs to be inherited correctly. In other words:

-v /home/me/folder/where/my/file/is:/documents:z
timo-a commented 2 months ago

Thanks! With :z appended it works. It says so in the Readme, but I mistakenly assumed SELinux to be a distribution and thus not applicable in my case.

mojavelinux commented 2 months ago

Glad to help! In my experience, it's always safe to append :z and you should always use it unless there is a specific reason not to.