How can I diagnose php cli command execution time inside a docker container
The general process of debugging inside the container is the same as debugging outside of one.  The only thing that you generally need to know is that you can use docker exec to attach a bash shell inside a running container, or override the command with --entrypoint to launch bash instead, and then run the script manually.

At that point, your question becomes "How do I debug slow execution times in a PHP script?".  That is not really in scope for this site, but you can start with a few basic things: add print statements or attach a profiler to see where things are getting slow, and then narrow it down from there.