Categories
Docker Linux Nextcloud

How to Fix Nextcloud Stuck in Maintenance Mode After a Docker Update

After pulling a new Nextcloud Docker image, you may find your instance stuck in maintenance mode and inaccessible. This is usually because the database or apps need upgrading before Nextcloud can start normally. Here’s how to resolve it quickly from the command line.


Quick Fix (One Command)

If you just need to get out of maintenance mode fast, run this from your host machine:

bash

docker exec -it nextcloud occ maintenance:mode --off

That’s often enough. If Nextcloud still won’t load, follow the full upgrade steps below.


Full CLI Upgrade Process

1. Enter the container

bash

docker exec -it nextcloud /bin/bash

You should land in /var/www/html — the directory where the occ tool lives.

2. Check the current status

bash

php ./occ status

Look for maintenance and needsDbUpgrade — if either is true, continue below.

3. Update all apps

bash

php ./occ app:update --all

4. Run the upgrade

bash

php ./occ upgrade

This updates the database schema and any apps that need it. You’ll see output as each step completes.

5. Turn off maintenance mode

bash

php ./occ maintenance:mode --off

6. Confirm everything is clean

bash

php ./occ status

All values should now show false for maintenance and upgrade flags. Your web interface should be back up.


Troubleshooting

“Could not open input file: ./occ” You’re likely not inside the Nextcloud container, or you’re in the wrong directory. Run pwd to check — you should be in /var/www/html. If not, either navigate there or use the one-liner from the host: docker exec -it nextcloud occ <command>.

App repair errors during upgrade Errors like RecursiveDirectoryIterator for a specific app (e.g. Recognize) usually mean a dependency is missing inside the container. The upgrade will still complete successfully. You can disable the offending app afterwards with:

bash

php ./occ app:disable <appname>

Tips

  • You can explore all available occ commands with php ./occ --help
  • On Unraid, you can also access the container console by clicking the Nextcloud icon in the Docker tab and selecting Console — no SSH needed
  • After resolving maintenance mode, it’s worth toggling Docker off and back on in settings to confirm the fix persists across restarts

Leave a Reply

Your email address will not be published. Required fields are marked *