tomsquest / docker-radicale

Docker image for Radicale calendar and contact server :calendar: + security :closed_lock_with_key: + addons :rocket:
GNU General Public License v3.0
593 stars 82 forks source link

Unable to change UID #124

Closed markuswells closed 1 year ago

markuswells commented 1 year ago

The docs say to run docker using docker run -e UID=123 -e GID=456 but I am using a docker compose file. I need the radicale user inside docker to be UID=1000 and GID=1000, everything else works as expected, but my data is: 2999:2999

here is my file:

version: '3.7'

services:
  radicale:
    image: 'tomsquest/docker-radicale:${RADICALE_IMAGE_VERSION:-latest}'
    container_name: radicale
    cap_add:
      - SETUID
      - SETGID
      - KILL
    environment:
      - 'BUILD_UID=${UID}'
      - 'BUILD_GID=${GID}'
      - 'TZ=America/New_York'
    healthcheck:
      test: 'curl -f http://0.0.0.0:5232 || exit 1'
      interval: 30s
      retries: 3
#    init: true
    labels:
      - 'traefik.enable=true'
      - 'traefik.http.routers.radicale.rule=Host(`ical.${SITE:-localhost}`) || Host(`l.${SITE:-localhost}`)'
      - 'traefik.http.routers.radicale.tls=true'
    networks:
      - 'traefik' # <== Placing this on the network
    read_only: true
    restart: always
    volumes:
      - './radicale/conf:/etc/radicale:ro' # <== Volume for dynamic conf files
      - './radicale/data:/data/collections/collection-root'
      - './radicale/logs:/logs' # <== Volume for log files
tomsquest commented 1 year ago

Hi @markuswells ,

The container cannot change the UID/GID when the volume is read_only. FYI, changing UID/GID is a write operation on the filesystem of the container, which read_only prevents.

Also, the variables are named UID and GID. The ones named BUILD_* are used when building the image, not starting the container.

So:

    environment:
      - 'UID=1234'
      - 'GID=1234'
markuswells commented 1 year ago

I did see the "read_only" in the docs, but did not realize I had it in the compose file. I made those changes and it works fine