ipsingh06 / seedsync

Sync your seedbox. Fast. And more.
https://ipsingh06.github.io/seedsync/
Apache License 2.0
312 stars 43 forks source link

PermissionError: [Errno 13] Permission denied: '/config/settings.cfg' #137

Open tylerk4 opened 8 months ago

tylerk4 commented 8 months ago

Running seedsync in a Docker container.

Docker-compose as follows (partially redacted):

version: '3.8'

services:  
  seedsync:
    image: ipsingh06/seedsync:latest
    container_name: seedsync
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /opt/seedsync/data:/config
      - /mnt/media/:/downloads
      - /mnt/backup:/backup/
    environment:
      - PUID=1000
      - PGID=1000
      - UMASK=000
      - TZ=XXXXX
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.seedsync.entrypoints=http"
      - "traefik.http.routers.seedsync.rule=Host(`seedsync.XXXX.XXXXXX.net`)"
      - "traefik.http.middlewares.seedsync-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.seedsync.middlewares=seedsync-https-redirect"
      - "traefik.http.routers.seedsync-secure.entrypoints=https"
      - "traefik.http.routers.seedsync-secure.rule=Host(`seedsync.XXXX.XXXX.net`)"
      - "traefik.http.routers.seedsync-secure.tls=true"
      - "traefik.http.routers.seedsync-secure.service=seedsync"
      - "traefik.http.services.seedsync.loadbalancer.server.port=8800"
      - "traefik.docker.network=proxy"

networks:
  proxy:
    external: true

When running docker compose up, the following error is shown:

[+] Running 1/0
 ✔ Container seedsync  Recreated                                                                                                                                                                                     0.0s
Attaching to seedsync
seedsync  | Traceback (most recent call last):
seedsync  |   File "/app/python/seedsync.py", line 378, in <module>
seedsync  |     seedsync = Seedsync()
seedsync  |   File "/app/python/seedsync.py", line 60, in __init__
seedsync  |     config.to_file(self.config_path)
seedsync  |   File "/app/python/common/persist.py", line 53, in to_file
seedsync  |     with open(file_path, "w") as f:
seedsync  | PermissionError: [Errno 13] Permission denied: '/config/settings.cfg'
seedsync  |
seedsync  | During handling of the above exception, another exception occurred:
seedsync  |
seedsync  | Traceback (most recent call last):
seedsync  |   File "/app/python/seedsync.py", line 386, in <module>
seedsync  |     Seedsync.logger.exception("Caught exception")
seedsync  | AttributeError: 'NoneType' object has no attribute 'exception'
seedsync exited with code 0
EnhancedTableLamp commented 6 months ago

Did you ever arrive at a solution for this issue? Running into the same error on my container.

timrettop commented 4 months ago

Its due to the container hardcoding the user ID and group ID, so your environment settings for PUID and PGID aren't being applied, and the UID 1000 / GID 1000 permissions aren't allowing the config file to be created/read on the bind mount. You could set /opt/seedsync/data to be owned by 1000:1000 (and if needed add the group to your user to manage or adjust permissions) Seems relatively useful to implement that environment support but I'm not sure if the project is active.