Docker Compose /mnt/data persistent directory permission issue

Been trying to give my server a custom directory on my drive, but it always fails with this error.

Attaching to owncloud_server
owncloud_server | Creating volume folders...
owncloud_server | mkdir: cannot create directory '/mnt/data/config': Permission denied
owncloud_server | mkdir: cannot create directory '/mnt/data/files': Permission denied
owncloud_server | mkdir: cannot create directory '/mnt/data/apps': Permission denied
owncloud_server | mkdir: cannot create directory '/mnt/data/sessions': Permission denied

docker-compose.yml

version: "3"

services:
  owncloud:
    image: owncloud/server
    container_name: owncloud_server
    restart: always
    ports:
      - ${HTTP_PORT}:8080
    environment:
      - OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN}
      - OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME}
      - OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD}
    volumes:
      - /media/data:/mnt/data

The folder already has 777 permissions and the server works fine if I let docker create a volume for itself.

Hi manjain,

Which folder is this?

For docker volumes the syntax is /host/path : /container/path
So in your case: does the directory /media/data exist?

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.