Cannot access to local external storage with docker

Hi all,

Currently I am trying to migrate to docker, the issue that I have now : I cannot connect to local storage through external storage :

This is my docker file :

  GNU nano 4.8                                                                                 docker-compose.yml                                                                                          
version: '3'

volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=somerootpassword
      - MYSQL_PASSWORD=somemysqlpassword
      - MYSQL_DATABASE=db
      - MYSQL_USER=mysqluser

  redis:
    image: redis
    restart: always
    command: redis-server --requirepass someredispassword

  app:
    image: nextcloud
    restart: always
    ports:
      - 8888:80
    links:
      - db
      - redis
    volumes:
      - nextcloud/:/var/www/html
      - /md127/nextcloud-data/:/var/www/html/data
    environment:
      - MYSQL_PASSWORD=somemysqlpassword
      - MYSQL_DATABASE=db
      - MYSQL_USER=mysqluser
      - MYSQL_HOST=db
      - REDIS_HOST_PASSWORD=someredispassword
    depends_on:
      - db
      - redis

Let me explain the architecture, I have 3 hdd :

  1. Which is the root of the server, including nginx, ubuntu and tralala
  2. md127 is a hdd where is store media + the volume for nextcloud
  3. md0 is a operational hdd, where is store docker files, … and where I am launching the docker-compose behind.

But I cannot link /md127 as external storage neither a folder inside. An other information : www-data is the group owner of /md127

Any idea ?

according to your config you mapped md127 to /var/www/html/data which is the “default internal” storage of the docker container. There is no need to configure volume as “local external storage”. In case you want you prefer to store your data somewhere else by default and add md127 as “external storage” please map it to a different mountpoint e.g.

    volumes:
      - ./nextcloud/:/var/www/html
      - ./nextcloud-data/:/var/www/html/data
      - /md127/nextcloud-data/:/data-on-md127

Thanks for your reply,

Perhaps I did not understand something : actually I want to access through NC to the folder /md127/films

How can I do it ?

Also trying to access to /md0 is not possible

Nextcloud is not a “storage only” application. all files stored in Nextcloud have a “pointer” stored in DB. this allows additional functionality like trashbin and versions… for this reason you should only manage files stored in NC through NC…

if for some reason you need to change files on NC storage you can perform occ files:scan to let the system learn new files. but it doesn’t detect files stored in some random folder… there is folder structure under /var/www/html/data/ each user has it’s own folder and the files lay there - Nextcloud will not expose some random files stored in e.g. ../films (ok you could create user films :wink: )

then you could add another volume for /md0 and mount it using local external storage… if you try to expose some random files to Nextcloud users you can mount all your “external” files as local external storage…