Exit maintanence mode in docker

Iā€™ve done some searching and I cannot seem to find how to exit maintenance mode if you youā€™re using docker. Everyone mentions to use this command sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off but that doesnā€™t seem to work in a docker instance.

Iā€™m using the ownyourbits instance and an error occurred during upgrade that I think is benign, but Iā€™m now stuck in maintenance mode. Thanks for any help.

1 Like

After digging some more I was able to find this article on github that showed how to start a bash from within the docker container. I might not be describing that 100% right, but I was able to disable maintenance mode by doing the following:

docker exec -u www-data -it nextcloudpi /bin/bash
php /var/www/nextcloud/occ maintenance:mode --off

A bit shorter (when using NCP):
docker exec nextcloudpi ncc maintenance:mode --off

How do you do this in 2020? When attempting to use

docker exec -u www-data -it nextcloudpi /bin/bash
php /var/www/nextcloud/occ maintenance:mode --off

It just produces

unable to find user www-data: no matching entries in passwd file

When leaving out the user specification -u www-data I get

/usr/bin/php: /usr/bin/php: cannot execute binary file
docker exec -u www-data -it nextcloudpi php /var/www/nextcloud/occ maintenance:mode --off

php is an executable. not a bash script. my guess.

1 Like

I wound up editing config.php and changed the maintenance mode variable to false.

1 Like

a probably useful guide for UCS users:

  1. Log into the Admin Console:
    Admin-username
    Admin-password

    su (for elevated rights)
    Admin-password

  2. Now shell into the Nextcloud container:

    univention-app shell nextcloud

    cd /var/www/html/config

    If vim is not yet installed:

    apt-get install vim
    Y

  3. Then:

    vim config.php

    Change line: ā€šmaintenanceā€˜ => ā€štrueā€˜ to ā€šmaintenanceā€˜ => ā€šfalseā€˜
    (Mind: press ā€œ:aā€ to enter edit in append-mode)
    :wq! , to save config.php without overwrite-prompt.

    exit
    exit

Thatā€™s it.

My user was not www-data but abc instead, and I had to put the full occ path:

docker exec --user abc nextcloud php /config/www/nextcloud/occ maintenance:mode --off

We can find the user/path listing the root contents like this and looking for the user thatā€™s not root and looking around to find the actual www folder:

docker exec --user root nextcloud ls -la /

Hi guys, a bit late to the party, but how do i enable maintenance mode of nextcloud docker? Cheers