singularity-docker icon indicating copy to clipboard operation
singularity-docker copied to clipboard

Run without --privileged

Open fcasson opened this issue 2 years ago • 4 comments

My use case is to use singularity in a docker image for testing of singularity images in gitlab CI with the docker executor.

Our sysadmins don't want to start the gitlab runners in privileged model for security reasons, so this looks like a non-starter unless there is a way to run the docker image without --privileged. My singularity images don't need to start any special services or open network ports, they just need to mount one directory which is in the same userspace as the user executing singularity run.

What is the fundamental limitation here that requires the --privileged mode of docker ? My niave understanding is that singularity only requires root access to install (which is already done within the docker image) but not to run, but maybe this is over-simplistic.

Would it make a difference if we install singularity into the Docker image without setuid and started the docker daemon with namespaces ?

fcasson avatar Jun 12 '23 14:06 fcasson

I'm not sure how the permissions have changed since I worked on it, you might want to open an issue to ask at https://github.com/sylabs/singularity. This repository is mostly just packaging the releases in a container.

vsoch avatar Jun 12 '23 17:06 vsoch

Okay I tried a few things including apptainer-suid (easier to install and setup) and sysbox and and I can't get it to work, e.g. this still fails:

docker run --runtime=sysbox-runc cassonf/rocky-apptainer:8.6 apptainer run docker://alpine

Info on why I tried sysbox for this use case: https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/

According to this issue singuliarty in docker without --privileged is considered a niche use case: https://github.com/apptainer/singularity/issues/5458, which I guess means it is not supported.

Closing this issue since as you point out it problably belongs in the singularity / apptainer issues list.

fcasson avatar Jun 14 '23 14:06 fcasson

Opened https://github.com/apptainer/apptainer/issues/1439

fcasson avatar Jun 14 '23 21:06 fcasson

Thank you @fcasson ! I'll follow along there too.

vsoch avatar Jun 14 '23 21:06 vsoch