PUID and GUID ignored by docker container

  • Following advice from https://wiki.omv-extras.org/doku.php?id=omv7:docker_in_omv, I would like to set a dedicated PUID and PGID per docker service.

    Hence, I edited the `environment` section of my docker compose file with the following lines:
    ```

    environment:

    PUID: ${ICLOUDPD_ID}

    PGID: ${ICLOUDPD_ID}

    ```

    However, the files created by the container still belong to `root:root`.
    I have another container for which this works however. What do I miss ?


    The compose file which gives me trouble is the following
    ```

    x-icloudpd: &icloudpd_base

    image: icloudpd/icloudpd:latest

    environment:

    TZ: ${TZ}

    PUID: ${ICLOUDPD_ID}

    PGID: ${ICLOUDPD_ID}

    volumes:

    - ${ICLOUD_STORAGE_FOLDER}:/data

    - ./pyicloud:/pyicloud

    stdin_open: true

    tty: true

    restart: "no"

    services:

    icloudpd-personal:

    <<: *icloudpd_base

    command: 'icloudpd --username "xxxhiddenxxx" --library "PrimarySync" ${ICLOUDPD_ARGUMENTS}'
    ```

    • Official Post

    What do I miss ?

    Environment variables have to be supported by the image. They aren't a universal docker setting.

    omv 8.0.6-1 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.2 | compose 8.1.2 | cterm 8.0 | borgbackup 8.0.2 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Official Post

    What is the best approach to have docker services write files with a different ownership than root:root ?

    Did you look at the docs for the image? https://github.com/boredazfcuk…b/master/CONFIGURATION.md

    omv 8.0.6-1 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.2 | compose 8.1.2 | cterm 8.0 | borgbackup 8.0.2 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • :o thanks ! I feel sorry you had to go through the doc of icloudpd. Thanks again 🙏


    edit: I'm actually not using the docker compose from boredazfcuk, so the suggestion doesn't apply to me, but I get it: There's not a universal way to do.

  • :o thanks ! I feel sorry you had to go through the doc of icloudpd. Thanks again 🙏


    edit: I'm actually not using the docker compose from boredazfcuk, so the suggestion doesn't apply to me, but I get it: There's not a universal way to do.

    There is an official way to run docker images as a different user than root while the deamon still runs as root, but some images might have problems with it.

    Its to add user: <uid>:<gid> in your compose file. But you will need to set up all the permissions. Linuxserver.io images might have problems with it. I don't run linuxserver.io images and what I run runs fine with non-root users.

    Linuxserver.io explains it very well.

    Running Containers As A Non-Root User - LinuxServer.io

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!