Just ran
docker exec CONTAINERID su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade'
Did have to chmod 777 custome_apps folder, got the idea from this post… Unable to run occ on command line - PHP fatal error memory exhausted in autoreload_real.php
“Yes, occ command was working fine before upgrade to 21 version. Now the only way to run it is: docker exec nextcloud su - www-data -s /bin/bash -c ‘php -d memory_limit=-1 -f /var/www/html/occ’ - that’s how I was able to add missing db indices. Any other method do not work for me.”
that made the upgrade run! yay!