Docker container run to deploy ucp service not working from shell script

I am trying the docker container run command to deploy the ucp service on the host. I am including this as part of a shell script and running the shell script on the box by opening the Jsch shell connection from my Java code.

When I run the script manually on the box, the docker run command works without issue. But when I run my Java code and in turn trigger the script on the box using expect operation. The docker container run install command is not getting triggered. This is a weird behavior considering it is working when I run the script manually on the box.

please let me know what could be the reason for this.

Source: StackOverflow