Installation Loop after restarting Nextcloud docker

i tried to set up my Nextcloud Server using my Raspberrypi 3b+ (The Guide i followed)

the first start of nextcloud (the Admin page where you can set up the database) worked perfectly fine, Created my account and set up the postgres Database. now i wanted to mount an external Hard drive to Nextcloud. so i stopped and removed the docker, formated my hard drive (dev/sda2) and mounted it to a folder /media/usbdrive.

after that i used this commands:

sudo chown -R www-data:www-data /media/usbdrive

then i started the docker again with this command:

docker run --name nextcloud -d -p 8080:80 -v /media/usbdrive:/data --network nextcloud-net -v /home/pi/nextcloud:/var/www/html nextcloud

now i am looped back at the Admin page where i can set up the database. but cant create my account and get this Error:

Error while trying to initialise the database: An exception occured while executing a query: SQLSTATE[42P07]:Duplicate table: 7 ERROR: relation “oc_migrations” already exists

next day i cant even access the admin page anymore.
when i try to access the site:
lbxA6wT

welcome @peaches to the userforums of NC.

I don’t have enough time to check your provided link for how and where it goes wrong…

but Ihave a suggestion to make to you: there’s a tool for rookies with a raspi… it’s called nextcloudpi

It helps you installing NCP to your raspi and usually works pretty flawlessly. Don’t worry - it’s an official NC-tool and pretty well maintained. So why not leaching their image, burn it to your SD and just psin it up?

hey,

Because i want to keep some space on the Pi with docker. So i can install Pihole or other Projects on the raspi in the future. I think that aint possible with NCP right? cause its the whole os? Thats why i started to use Docker.

referring to what I read on the forum it seems to be possible

Yes you can use NCP docker image

docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v /path/to/ncdata:/data --name nextcloudpi ownyourbits/nextcloudpi DOMAIN/localIP