Clean up unused staffs.
docker system prune
See also qiita.
When standard input is required. Add -T option.
-T
docker compose exec -T db mysql dbname < backup.sql