Command works in shell but not in cron job

I have on my truenas (ElectricEel-24.10.2) nextcloud with mysql in a docker container runnig. For backing up the database I have script in the container that works fine if I run it from the shell

docker exec -it docker ps | grep -w "nextcloud-neu-db" | awk '{ print $1; }' bash /mnt/backup/scripte/mysql_backup_2.sh

If I try to run this as a cron job, it doesn’t work.

I have a cron job perfectly running wit a similar command

docker exec --user www-data docker ps | grep -w "nextcloud-neu-app" | awk '{ print $1; }' php /var/www/html/cron.php

What am I missing?

I replay to myself, I found the solution. I have to execute the command without the -it.