singularityhub / singularityhub.github.io

Container tools for scientific computing! Docs at https://singularityhub.github.io/singularityhub-docs
https://singularityhub.github.io
68 stars 9 forks source link

Permission denied when using %files on shub #146

Closed rcannood closed 6 years ago

rcannood commented 6 years ago

Hello @vsoch!

Link to Container Collection Log, Build, or Collection (in that order)

https://www.singularity-hub.org/collections/1533 https://github.com/dynverse/ti_angle/tree/396c57b1e5d7dac99d65a8819634bc1ff71cd4cf

Behavior when Building Locally

$ singularity build image.simg Singularity
$ singularity exec image.simg cat /code/definition.yml
# works!

Error on Singularity Hub

Not right now, but when the repository was at commit ddbbc0bde0b9343a2a3e52fd31a692fbd9476497, I would get the following problem:

$ singularity pull --name image.simg shub://dynverse/ti_angle
$ singularity exec image.simg cat /code/definition.yml
Permission denied

What do you think is going on?

The recipe on this repository contains the following lines:

%files
    . /code

The problem is that the working directory on the shub builder has chmod 700 and chown root.root, and these permissions are being carried over to the /code folder in the container.

I solved the problem by adding the following lines:

%post
    chmod -R a+r /code
    chmod a+x /code

Am I correct in thinking that by having the default chmod set to 700 results in everybody having to chmod a+r and a+x in %post in order to be able to access the files later on? Or is it just me? :)

Thanks for looking into this! Robrecht

vsoch commented 6 years ago

I think permissions (and defaults) for what happens during the build are likely either set (defaults) by the singularity software proper, or by the user (as you have done!) The builder simply issues the build command. At least with Docker I always have to do chmod u+x /entrypoint.sh for my entrypoint. It could be that the builder you are using locally is also a more recent version of Singularity, in which case the update to 3.0 (when it's ready) should do the trick. Your workaround for now seems ok. If you have issue with the singularity defaults during build, I would open an issue on that repository. Thanks!

vsoch commented 6 years ago

Closing issue, user reports resolved and no response. Thanks!