What if:
Just run the following command, replacing nextcloud_app with the actual container name of your Nextcloud Docker install:
nextcloud_app
docker exec -u www-data nextcloud_app php occ files:scan --all
This is working for me, on Nextcloud version 27.0.1.