Volumes in docker container for nextcloudpi: Open failed (2: No such file or directory)

I tried to setup ncp with a reverse proxy and followed these insctructions.

Before I always started my container with:

sudo docker run -d -p 4443:4443 -p 4433:443 -p 83:80 -v ncdata:/data -v /media/simon/:/extHDD/ --name nextcloudpi ownyourbits/nextcloudpi 192.168.103.44

and this was working very well.

Now I have this docker-compose.yml:

version: '3.5'

networks:
  nextcloudpi:

services:
  # main nginx : reverse proxy for ssl
  nginx:
    restart: always
    container_name: raspberry-pi-master-nginx
    image: simon/raspberry-pi-master-nginx:latest
    ports:
      - "80:80"
      - "443:443"
      - "4443:4443" # configuration port for nextcloudpi
    volumes:
      # for error.log (choose any volume path you want)
      - ./nginx:/var/log/nginx
      # nginx.conf expects ssl files here
      - /etc/letsencrypt/live/:/etc/letsencrypt/live
      - /etc/letsencrypt/archive:/etc/letsencrypt/archive
      # DH params (needs to be generated first, see e.g.: `sudo openssl dhparam -out /etc/ssl/dhparam.pem 4096`
      - /etc/ssl/:/etc/ssl
      - /home/simon/Downloads/ncp_nginx_proxy_docker:/etc/nginx/
    depends_on:
      - nextcloudpi
    networks:
      - nextcloudpi

  ##################

  # nextcloud pi
  nextcloudpi:
    restart: always
    container_name: nextcloudpi
    image: ownyourbits/nextcloudpi:latest
    expose:
      - 80
      - 443
      - 4443 # nextcloudpi web config ui port
    volumes:
    - /etc/localtime:/etc/localtime:ro
    - /media/simon/:/extHDD/
    - /ncdata:/data
    networks:
      - nextcloudpi

and get this error:

It seems everything ok with the volume:

simon@simon-itx:~/Downloads/ncp_nginx_proxy_docker$ sudo ls -lh /var/lib/docker/volumes/ncdata/_data
[sudo] password for simon:
total 98K
drwxr-xr-x  3 root            root              26 Apr  8 08:22 bin
drwxr-xr-x  5 systemd-resolve systemd-network   13 Jun 20 10:34 database
drwxr-xr-x  9 root            root              10 Apr 13 07:49 etc
drwxr-sr-x  3 root            www-data          44 Mai 13 19:23 ncp
-rwxr-xr-x  1 root            root            280K Jun  3  2021 ncp-config_20210603.tar
drwxr-xr-x 14 www-data        www-data          28 Mai 13 19:25 nextcloud
simon@simon-itx:~/Downloads/ncp_nginx_proxy_docker$ docker volume inspect ncdata
[
    {
        "CreatedAt": "2022-06-15T21:10:18+02:00",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/ncdata/_data",
        "Name": "ncdata",
        "Options": null,
        "Scope": "local"
    }
]

What should I do?

-v ncdata:/data

is a placeholder. It needs to be the literal directory on your filesystem.

-v /my/actual/directory/location/of/ncdata:/data

1 Like
~$ docker inspect ncdata
[
    {
        "CreatedAt": "2022-06-15T21:10:18+02:00",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/ncdata/_data",
        "Name": "ncdata",
        "Options": null,
        "Scope": "local"
    }
]

So it should be:

    volumes:
    - /etc/localtime:/etc/localtime:ro
    - /media/simon/:/extHDD/
    - /var/lib/docker/volumes/ncdata/:/data

?

Because that leads to
`

$ docker logs nextcloudpi
Making /usr/local/etc/ncp-config.d persistent ...
Making /etc/services-enabled.d persistent ...
Making /etc/letsencrypt persistent ...
Making /etc/shadow persistent ...
Making /etc/cron.d persistent ...
Making /etc/cron.daily persistent ...
Making /etc/cron.hourly persistent ...
Making /etc/cron.weekly persistent ...
Making /usr/local/bin persistent ...
Making /etc/apache2 persistent ...
Starting PHP-fpm
Starting Apache
Starting mariaDB
2022-06-24 11:41:49 0 [Note] mysqld (mysqld 10.5.12-MariaDB-0+deb11u1) starting as process 168 ...
2022-06-24 11:41:49 0 [Warning] Can't create test file /data/database/b57830234095.lower-test
mysqld: Can't change dir to '/data/database/' (Errcode: 2 "No such file or directory")
2022-06-24 11:41:49 0 [ERROR] Aborting
$ sudo ls -lh /var/lib/docker/volumes/ncdata
total 36K
drwxr-xr-x 3 root root     25 Mär  7 19:41 bin
drwxr-xr-x 7 root root      8 Jun 15 21:10 _data
drwxr-xr-x 9 root root     10 Jun 24 11:41 etc
drwxr-xr-x 3 root www-data 43 Mär  7 19:42 ncp