For jenkins pipeline stage with docker image, you need to run docker with -u root
GIT_COMMIT var is not defined at launch of pipeline

To escape special characters in the sh section of a Jenkinsfile, you can use a backslash (\) before the character. For example, if you want to escape the dollar sign $, you can use \$. Here’s an example:

stage('Example') {  
steps {  
sh 'echo "This is a dollar sign: \$"'  
}  
}  

In this example, the sh command will output This is a dollar sign: $. The backslash before the dollar sign tells the shell to interpret it as a literal dollar sign, rather than a shell variable.

When working with multibranch pipeline in jenkins, prefer checking out the git repo yourself and set the env GIT_BRANCH and GIT_COMMIT, because in case of Pull request the branch name will be PR-x