Linux scheduled task backup docker database problem

this is a backup script

-sharp!/bin/bash
docker_name=mysql_container
data_dir=/home/ubuntu/mysql_dump
/usr/bin/docker exec -it $docker_name /usr/bin/mysqldump -u root -p root --all-databases > "$data_dir/data_`date +%Y%m%d`.sql"

A file with data can be generated by using sh directly, but through the scheduled task * / bin/sh / home/ubuntu/mysql_dump/mysql_dumps.sh , the backup file can be generated and the file content is empty. What is the situation?

Mar.02,2021

-sharp!/bin/bash
docker_name=mysql_container
data_dir=/home/ubuntu/.data/mysql_dump
/usr/bin/docker exec $docker_name sh -c "mysqldump -uql -pqliang978 --databases voyager > /var/local/data_`date +%Y%m%d`.sql"
find $data_dir -mtime +7 -name 'data_*.sql' -exec sudo rm {} \

modify the bash script, and then mount / usr/local to the host in docker-compose

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e461b9-59110.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e461b9-59110.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?