Unable to activate Nextcloud maintenance mode

Hello, I have a problem entering or exiting maintenance mode.

Information:

  • I have Nextcloud by Docker on Raspberry Pi 4, Raspbian Duster
  • Nextcloud version: 22.0.0
  • User pi belongs to the group www-data.

To put in maintenance mode I run:

cd / home / pi / docker / nextcloud /
sudo -u www-data php occ maintenance: mode --on

But I get this error:

An unhandled exception has been thrown:
Doctrine \ DBAL \ Exception: Failed to connect to the database: An exception occurred in the driver: could not find driver in /home/pi/docker/nextcloud/lib/private/DB/Connection.php:87

Thanks!

I found the solution:

When working with Docker, the maintenance order must be inside the container and not outside, the order must be:

Enter maintenance mode:

docker exec -u www-data -it nextcloud php occ maintenance:mode --on

Exit maintenance mode:

docker exec -u www-data -it nextcloud php occ maintenance:mode --off

“nextcloud” is the docker’s name.

Best regards