The problem here ended up being settings in my Git repo. Since the repo is on a Windows machine, my core.autocrlf setting was not set to false as it should have been.
This resulted in CR characters being appended to each line of the .sh scripts being run inside the Docker machine. Since that machine is Linux this caused problems.
PSA: SET core-autocrlf=false ON ANY REPO BEING DEPLOYED TO LINUX DOCKER MACHINES FROM A WINDOWS MACHINE