Cannot enable tty on non tty input device

When executing docker locally on the machine it was executing successfully without any errors. When trying the same command from Jenkins machine to the target (docker machine) i was facing the issue

below is the command i’am trying
docker exec -ti containerid bash
error:cannot enable tty mode on non tty input.
It is mandatory to run the script in tty mode.
I tried changing requiretty in sudoers file but not able to solve the issue.
if anyone has solutions please share here.