Skip to content

[BUG] OC_CONFIG_DIR variable causes permission denied error inside container #1279

@wearepariah

Description

@wearepariah

Describe the bug

OC_CONFIG_DIR environment variable is used within opencloud code to refer to paths inside the Docker container, but also recommended in examples/instructions to refer to paths on the host. This leads to errors attempting to mkdir paths inside the container if that path is not writeable by 1000:1000.

Steps to reproduce

  1. docker compose per the instructions
  2. utilise the OC_CONFIG_DIR variable to set your host config directory (owned and fully writeable by user 1000:1000).
  3. use a directory that would not be writeable inside the container without root. e.g. /cloud/opencloud/config

Expected behavior

docker compose up, opencloud init would run and create config files on the host per the variables.

Actual behavior

Attempts to mkdir at the OC_CONFIG_PATH directory within the container, causing error Could not create config: mkdir /cloud: permission denied

Setup

Running within the openmediavault-compose extension v7.6.12 for Open Media Vault 7.7.13-1 (Sandworm), on Debian Bookworm 6.12.34+rpt-rpi-2712. Hardware is a Raspberry Pi 5.

Details

compose.yaml

name: opencloud
services:
  opencloud-server:
    container_name: opencloud-server
    image: opencloudeu/opencloud-rolling:${OC_VERSION:-latest}
    networks:
      opencloud-net:
    entrypoint:
      - /bin/sh
    command: ["-c", "opencloud init || true; opencloud server"]
    ports:
    - 8083:9200
    volumes:
      - ${OC_CONFIG_DIR:-opencloud-config}:/etc/opencloud #not working if OC_CONFIG_DIR is used
      #- ${OC_CONF_DIR:-opencloud-config}:/etc/opencloud #working
      - ${OC_DATA_DIR:-opencloud-data}:/var/lib/opencloud
    restart: no
    env_file:
      - opencloud.env
volumes:
  opencloud-config:
  opencloud-data:

networks:
  opencloud-net:

opencloud.env

OC_INSECURE=false
PROXY_TLS=false
OC_URL=https://sub.domain.tld
OC_CONFIG_DIR=/cloud/opencloud/config #not working if OC_CONFIG_DIR is used
#OC_CONF_DIR=/cloud/opencloud/config #working
OC_DATA_DIR=/cloud/opencloud/data
OC_VERSION=3.2
IDM_ADMIN_PASSWORD=admin

Additional context

This example is being used as a test/experiment environment, not intended to go to production in this state.
Instructions within the common issues resource handle permissions on the host, rather than within the container.

If i had to guess (not particularly experienced with GoLang), this might have something to do with it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions