bt-sync / sync-docker

Resilio Sync docker image
https://www.resilio.com
180 stars 61 forks source link

Docker UID and GID #12

Closed dionysiusmarquis closed 6 years ago

dionysiusmarquis commented 7 years ago

Hey,

currently Resilio Sync Docker always runs as root and creating new synced folders with root permissions. Is it possible to run the container with specific UID? Adding UID and GID That would help to read out the folders from another Docker container.

DBLaci commented 7 years ago

Workaround:

You can set git / uid (docker --user uid:gid) but you have to set volume for the /mnt/sync from the host (create it with the correct permissions)

tkodev commented 7 years ago

@DBLaci What do you mean "set volume for the /mnt/sync from the host"? If I have a folder that is owned by my uid/gid with rw permissions is that good enough?

DBLaci commented 7 years ago

Yes of course. I have to admit I can't remember why I write that part... :) The workaround is for forcing the user at container level. I think implementing the env variables to set the process userid/groupid would be better solution.

artempronevskiy commented 6 years ago

@DBLaci --user is not a workaround, this is proper way to run the app inside a container as a specific user by specifying UID and GUID

Jip-Hop commented 6 years ago

I'm using this Docker image on my Synology NAS, which comes with a web interface to configure Docker containers. I have set the PGID and PUID environment variables using the web interface, but Resilio still runs as root. From the Synology Docker web interface I see no way to run with --user uid:gid. Therefore I think it would be great if the image would take these environment variables into account. Or is there another supported way to specify the user that's compatible with Docker on Synology NAS?

Jip-Hop commented 6 years ago

By using Docker compose I was able to run Resilio Sync under a specific user (with uid and gid), while also integrating with the Synology Docker GUI.

Here's an incomplete example of my Docker compose yml file.

version: '2'

# Define services
services:
  resilio-sync:
    image: resilio/sync
    container_name: resilio
    volumes:
      - /path/to/resilio/folder/on/host:/mnt/sync
    restart: always
    user: "2000:100"
    environment:
      - TZ=Europe/Amsterdam