@Sam Sperling
It appears that the portion of the script failing is the last few lines. The screen command is the one returning the error "Must be connected to a terminal." I found a few related issues to this with some workarounds. You might try executing them by editing the script to include the command.
"Inside the docker container, run script /dev/null first. Then you should be able to start screen"
https://github.com/moby/moby/issues/30421
https://github.com/moby/moby/issues/728
-------------------------------
Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.