#Directory permissions

1 messages · Page 1 of 1 (latest)

zealous vapor
#

what about directory permissions? I'm playing around with dagger shell. I'm building code in one container, then I want to mount artifacts in another for post-processing (different toolset). Problem is, the first container runs as root, the other -- as uid=1000. And first container's artifacts are behind a permissions' barrier to the other container's processes. Is there a dagger-suggested way to remediate it? Or do I have to chown -R 1000 in the first container?


allure=$(
    container |
    from frankescobar/allure-docker-service |
    with-directory /src $($ctr | directory /src/build/) |
    with-workdir /src |
    with-exec -- ls -l ./
)
37  : Container.withExec DONE [5.9s]
37  : [5.9s] | total 76
37  : [5.9s] | drwxr-xr-x 7 root root  4096 Apr  1 12:31 allure-report
37  : [5.9s] | drwxr-xr-x 2 root root 73728 Apr  1 12:31 allure-results
idle eagle
#

Hey!

In case this was not obvious, You can always get help for any function directly in the shell by using .help

For example container | .help with-directory will show you all the additional args that with-directory has, this includes information on how to set the owner/group

  --owner string       A user:group to set for the directory and its contents.

                       The user and group can either be an ID (1000:1000) or a name
                       (foo:bar).

                       If the group is omitted, it defaults to the same as the user.

                       (default: "")

I think running with-exec chown... will also work fine, but using the api like this is the recommended way to do it.