Jun Aishima
08/21/2025, 9:00 PMpodman run -v /top/dir1:/top/dir1 --userns keep-it:uid=<uid1>,gid=<gid1> <image>
, where service user <uid1>:<gid1>
only has access to /top/dir1
. However, when trying to implement having separate users in Prefect, there are no options with docker-py or Prefect for propagating the userns option to podman (as no options like these exist for docker). I had been using work-pool job_variables to attempt to pass these when running a container, but these workflows all end up running as root.
What are my best options for hosting multiple Prefect workers on a single host, each capable of writing to a storage system that has multiple subdomains that can be accessed by a separate user/group? (The images to be run are different, but that is easily solved by deploying with different images - control of the user running the container is the main difficulty I am having.)Brendan Dalpe
08/22/2025, 2:04 PMBrendan Dalpe
08/22/2025, 2:06 PM--userns
equivalent in Docker. You could do this for the entire Docker daemon, but I don't think this accomplishes what you want. https://docs.docker.com/engine/security/userns-remap/Brendan Dalpe
08/22/2025, 2:10 PMuser
in the kwargs in your Prefect deployment job variables like this:
job_configuration:
container_create_kwargs:
user: 123:123
But this means the container runs as this user instead of remapping the namespace...Jun Aishima
08/22/2025, 3:43 PMcontrainer_create_kwargs
), but will also try the suggestion for user
as well.Jun Aishima
08/22/2025, 4:59 PMkeep-id:uid=<uid>,gid=<gid>
resulted in the following exception when Prefect was trying to run the container:
crun: mount sysfs to sys: Operation not permitted: OCI permission denied
But when I tried to use user: <uid>:<gid>
then the git cloning step of deployments failed:
subprocess.CalledProcessError: Command '['git', 'clone', '<https://github.com/><me>/<workflow code>.git', '--branch',..... returned non-zero exit status 128.