![]() | ![]() |
The time had come again. A Docker Nextcloud environment was created, but unfortunately the admin password can no longer be found. Fortunately, there is the „occ“ tool for Nextcloud, with which the password can be reset. This can be done on normal Nextcloud installations with the following command:
sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin
Unfortunately, this command does not work in the official Nextcloud Docker container, because there is no „sudo“ installed. However, this is not a major problem. With an adapted „docker exec“ the user change can also be achieved:
docker exec -it -u www-data <<containername>> php /var/www/html/occ user:resetpassword admin
After that, enter a new password twice and you can access Nextcloud again.


www-data@b1ac1daca897:~/html$ php /var/www/html/occ user:resetpassword admin
An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at „db“ (172.19.0.5), port 5432 failed: FATAL: password authentication failed for user „oc_admin“ in /var/www/html/lib/private/DB/Connection.php:140
Stack trace:
I have moved the docker compose deployment to another host. I think it’s related to the salt and scrambled way of encrypting the passwords, but I cannot use my existing database (postgres) for nextcloud.
How could I tell nextcloud what credentials it should use for accessing the database?
Postgres is also a container and it has an oc_admin and I know its password. My problem is the config.php file that has the password scrambled, so cannot specify it. I suppose.
Thanks.
LikeLike
Mit kurzen Worten: DANKE! Daran habe ich mir den halben Tag die Zähne ausgebissen.
LikeLike