Skip to main content

Docker Container keeps restarting - Troubleshooting Nextcloud

This case, it was already working. Ended up pulling a new image but didnt know it. 

First, check docker logs. Run the container and let it keep restarting so that it will give you an error log. 

docker logs <nextcloud_container_name>

Error said:
Initializing nextcloud 31.0.1.2 ...
Can't start Nextcloud because upgrading from 29.0.0.19 to 31.0.1.2 is not supported.
It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.

That means files/data is for version 29 and i need to incrementally go up to V31.

Lets get the versions in between to install it correctly.

If the containers are running. stock them.

docker-compose down

Check Your Current Data

Your Nextcloud data (files and database) is tied to version 29.0.0.19. Ensure your volumes (./nextcloud and ./mariadb) are intact, as they contain your files and database. If you have backups, now’s a good time to confirm they’re ready—just in case.

Upgrade Step-by-Step

You’ll need to run intermediate versions of Nextcloud to perform the upgrades. Modify your docker-compose.yml to pull specific versions, starting with the next major version after 29.

Upgrade Step-by-Step

  • You’ll need to run intermediate versions of Nextcloud to perform the upgrades. Modify your docker-compose.yml to pull specific versions, starting with the next major version after 29.
services:
  nextcloud:
    image: nextcloud:30
    # ... rest of your config ...
  mariadb:
    # ... no change needed here ...
  • Start the containers:
docker-compose up -d
  • Check the logs to confirm it’s running:
docker-compose logs -f
  • Nextcloud should automatically run the upgrade process for version 30. Wait until it stabilizes (logs should stop showing errors and indicate a successful start).

Upgrade to 31.0.x

  • Once version 30 is running fine, stop the containers:
docker-compose down
  • Update docker-compose.yml to the desired version (31.0.1.2 or latest 31):
services:
  nextcloud:
    image: nextcloud:31
    # ... rest of your config ...
  • Restart:
docker-compose up -d
  • Check logs again:
docker-compose logs -f

 The upgrade from 30 to 31 should proceed. Once complete, your Nextcloud should be fully operational on 31.0.1.2.