Reset or create new admin user from CLI, in docker environment

Hi there,

so I managed to install Docker painfully in a docker environment, using dedicated macvlan IPs. Now, after lots of hours for fiddling around, I was finally presented with the login screen.

Luckily - as i thought - I copy pasted the initial admin and its long default password in to a blank text file. But these credentials were not accepted.

I cant reset the password since I never provided the system with my E-Mail (nor logged in before).

So I tried

cli:$ sudo docker exec -it nextcloud-aio-mastercontainer bash
02322174364d:/var/www/docker-aio# sudo -u www-data php occ user:add newusername --password newpassword
Could not open input file: occ

So I guessed the filestructure is not correct, maybe I addressed the wrong container:

cli:$ sudo docker exec -it nextcloud-aio-database bash
d180dd92255f:/$ sudo -u www-data php occ user:add newusername --password newpassword
bash: sudo: command not found
// without sudo:
d180dd92255f:/$ php occ user:add newusername --password newpassword
bash: php: command not found

Am I using the right container? where is that file I need to edit in order to create a new admin user?

The right container would be nextcloud-aio-nextcloud.

Worked, thanks!

For others seeking this, this was my command:

sudo docker exec -it nextcloud-aio-nextcloud bash

Within the container then:

sudo -u www-data php occ user:add --display-name=“YourName” --group=“users” --group=“db-admins” yourname