Nextcloudpi in Docker on Raspberrypi 4 not working

Hi guys,

i’m stuck with trying to run nextcloudpi in docker on my rasppi. It’s a fresh pios, i installed docker and then portainer, after that i wanted to continue with nextcloudpi.
I ran the container in docker using this command:
docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v nextclouddata:/data --name nextcloudpi ownyourbits/nextcloudpi “domain.xx”

I get a lot of operation not permitted errors in the log, here is a quote of the log:

cp: preserving times for '/data/nextcloud/apps/notes/lib/Controller/NotesController.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Controller/PageController.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Controller/SettingsController.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Controller': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Db/Meta.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Db/MetaMapper.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Db': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Migration/Cleanup.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Migration/Version3005Date20200528204430.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Migration/Version3005Date20200528204431.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Migration': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/ImageNotWritableException.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/InsufficientStorageException.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/MetaNote.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/MetaService.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/Note.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/NoteDoesNotExistException.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/NoteNotWritableException.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/NoteUtil.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/NotesFolderException.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/NotesService.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/SettingsService.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/TagService.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service/Util.php': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib/Service': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/lib': Operation not permitted
cp: preserving times for '/data/nextcloud/apps/notes/templates/dev-mode.php': Operation not permitted

and in the end:

sleep: cannot read realtime clock: Operation not permitted
sleep: cannot read realtime clock: Operation not permitted
sleep: cannot read realtime clock: Operation not permitted
sleep: cannot read realtime clock: Operation not permitted
sleep: cannot read realtime clock: Operation not permitted
sleep: cannot read realtime clock: Operation not permitted

Any ideas on how to fix this?

I don’t know for sure but it looks like a permissions issue based on the error message you’re getting. So maybe, either you or docker don’t have permissions to the directories and/or volumes docker is trying to manipulate.

Did you try running the command with sudo in the beginning?

yeah it seems like it, but i gave the user pi permissions for docker with

sudo usermod -aG docker $USER

running the run command with sudo doesn’t make a difference sadly

I see…

What are the permissions of the nextclouddata data directory?

I don’t know but could it be the permissions there?

If I’m not mistaken, it should be owned by www-data

This article/post might be a useful read I think

I’m not sure how i can view the permissions to be honest.
nextclouddata is the host volume in docker, its path in the container is /data.

When i ssh into the container the permissions for data look like this:

Hmm, alright let’s try this instead :slight_smile:

First, did you pull the docker image with the command below?

sudo docker pull ownyourbits/nextcloudpi:latest

After that, or if you already did this, can you try and run the command below?
Note, edit $YOUR_IP and put the IP address of your host there

sudo docker run -d \
-p 4443:4443 -p 443:443 -p 80:80 \
-v nextclouddata:/data \
--restart unless-stopped \
--name nextcloudpi \
ownyourbits/nextcloudpi $YOUR_IP

If the container starts then you can go to your IP-address in a browser and you should see the activation page.

Were you able to see the activation page after following these steps?

It is really strange. I tried the post you mentionend in your post before again, and while it still throws the same errors in the logfile, i can view the activation page now, where i try to activate nextcloudpi. It doesn’t work though, after i click activate it shows

NextCloudPi not yet initialized, trying again in a few seconds ...

and nothing happens then. Logfile from the container still throwing the same errors as mentionend in my first post.

I mounted an external drive now for nextcloud (as described in the post you linked), and i set the permissions like that:

sudo chown www-data:www-data -R /media/share/ncdata/nextcloud

when i run the docker container though, it creates files inside the folder with root ownership.

image

is this how it is supposed to be?

Yes, if you see the activation page it should work, it takes awhile to activate, just wait :slightly_smiling_face:

If you used an external drive did you modify your docker command to use the absolute path as well?

I tried this yesterday on my RPi4, the docker command for running without external data directory and accessing it via the IP address in the browser, which worked right away.

sudo docker pull ownyourbits/nextcloudpi:latest
sudo docker run -d \
-p 4443:4443 -p 443:443 -p 80:80 \
-v nextclouddata:/data \
--restart unless-stopped \
--name nextcloudpi \
ownyourbits/nextcloudpi $YOUR_IP

The pi I have is setup to boot directly from an external USB 3.0 4TiB HDD, with Debian Bullseye installed directly on the external drive.

Trust me, i’ve waited a very long time. Nothing happens.

I see, what is your setup & what steps are you taking?

How did you install Docker? The Docker Engine when using raspbian is best installed via Docker’s install script on https://get.docker.com as they say in their docs here and if you have old versions installed you need to remove them before you install using this script.

Since it works for me without issue, though I’m not using an external drive as data directory for the docker container.

If you have docker-compose, which is installed through the docker install script, I created a docker-compose.yml file that I just tested and is working.
Put it inside a directory/folder and run it with
sudo docker-compose up -d

The data volume is not external in this one but can be changed by setting external: false to external: true. If you’re using NCP locally, when you get to the admin page at :4443 you may need to add your IP-address of the host in nc-trusted-domains to access the regular nextcloud interface via IP-address in the browser.

docker-compose.yml

version: "3.3"

services:
  nextcloudpi:
    image: 'ownyourbits/nextcloudpi:latest'
    restart: unless-stopped
    container_name: nextcloudpi
    volumes:
      - ncdata:/data
    ports:
      - 80:80
      - 443:443
      - 4443:4443

volumes:
  ncdata:
    external: false

i appreciate your time, but i feel like we are running in circles here. i added the stack via portainer, with the adjustments to use the external drive:

Same problem as before.

Try setting the permissions for ncdata?

sudo chown www-data:www-data -R /media/share/ncdata

Also, since it says it’s running, what happens when you access the IP address in a browser?

I did, permissions look good.

It keeps loading infinitely

i’ve installed it that way. only different thing i did was to install portainer too

here is my version:

Alright, unfortunately I don’t know why it isn’t working for you, I’m just trying to help you figure it out as best I can :pray:

Thank you for the info, you’re on the same docker version as me, so in that regard it should be correct and work.


Edit: Though wait … your OS seems to say linux/arm and not linux/arm64? Is it a 32bit OS?

It should work for 32bit, it would just be another difference to note.

Could also try pulling the 32bit container directly instead.

armhf: Docker Hub
x86: Docker Hub

Here’s my info

Client: Docker Engine - Community
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:02:34 2022
 OS/Arch:           linux/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:01 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Since the only difference then seems to be with portainer, could you try and launch via CLI using the sudo docker or sudo docker-compose command instead?

For instance, using the command without external data first to see if you can get that working?

sudo docker run -d \
-p 4443:4443 -p 443:443 -p 80:80 \
-v ncdata:/data \
--restart unless-stopped \
--name nextcloudpi \
ownyourbits/nextcloudpi $YOUR_IP

P.S
This is the docker-compose.yml file from the repository.

version: '3'
services:
  nextcloudpi:
    image: ownyourbits/nextcloudpi-x86
    command: "${IP}"
    ports:
     - "80:80"
     - "443:443"
     - "4443:4443"
    volumes:
     - ncdata:/data
     - /etc/localtime:/etc/localtime:ro
    # for nc-encrypt
    devices:
      - /dev/fuse:/dev/fuse
    # for nc-encrypt # NOTE: take a look at this https://github.com/docker/for-linux/issues/321#issuecomment-677744121
    cap_add:
      - SYS_ADMIN
    container_name: nextcloudpi

volumes:
  ncdata:

Thank you, i really appreciate your help.

That is strange indeed, i’m running 64bit:

As i installed docker via the script, could it be possible that the script pulled the 32bit version for some reason?

You’re welcome :pray:

That is strange indeed, very interesting it isn’t working for you, and yes, it is always a possibility that the script could have pulled the wrong architecture, the script uses the arch=$(dpkg --print-architecture) command to set the architecture for the repository to docker.

arch=$(dpkg --print-architecture); echo "$arch"

My ouput for this command is arm64

└࿓❯ arch=$(dpkg --print-architecture); echo “$arch”
arm64

The architecture that have been set for the package repository should also be written in the docker.list
sudo cat /etc/apt/sources.list.d/docker.list

Just to double-check, you did remove the previous docker installation/packages before using the script?

And how did it go when you used the commands directly without an external data volume?

Hi ZendaiOwl,

it took me some time, but i decided to purge my os completely and reinstall a 64-bit piOS, as i figured i was running a 32bit system. I’ve installed docker like described in the post you linked again, and after that i installed nextcloudpi and portainer. I can proudly say: it is working now, and your help played a big part in it! Thank you for your patience, i appreciate it man.

2 Likes

That’s wonderful! Glad you got it working :slight_smile:

You’re welcome & thank you :pray:

1 Like