I have an example in my guide for how to run occ.
If the www-data user in the Docker container can’t access OCC, then you have something else going on because in a stock setup this works as documented.
You can add a bash alias outside the container to make life easier.
echo alias occ=\'docker exec -it -u www-data nextcloud php occ\' >> ~/.bashrc
. ~/.bashrc
Then you can simply type occ at the host’s prompt and the command will run as www-data inside the container.
Also, you need to resolve all warnings on your system, and make sure you set up memory caching.