How to run Nextcloud "php occ" in a docker-compose configuration
Use this command to run php occ
inside a running docker Nextcloud container:
docker-compose exec -u www-data nextcloud php occ [command]
where:
nextcloud
is the name of your container in docker-compose-u www-data
tellsdocker-compose
to run the command as thewww-data
user that owns all the Nextcloud files.- Replace
[command]
by thephp occ
command you want to run, for exampleversions:cleanup
. If you want to see a list of all available commands, just omit[command]
Note: You need to run this command in the directory where your nextcloud docker-compose.yml
is located.
Example:
docker-compose exec -u www-data nextcloud php occ versions:cleanup
or:
docker-compose exec -u www-data nextcloud php occ trash:cleanup --all-users