Dockerfile can’t find shell script on build [duplicate]

This question already has an answer here:

I’m trying to docker build an application that utilizes go. To install go, the dockerfile has the following command (this executes fine, by the way):

RUN wget https://dl.google.com/go/go1.11.linux-amd64.tar.gz 
    && tar -xf go1.11.linux-amd64.tar.gz 
    && mv go /usr/local

The problem arises when script runs shell files within the ‘install’ subdirectory. Note, output of the following two steps:

Step 9/13 : RUN . install/install-lmdb-linux.sh
 ---> Running in 0c666807720a
: not found install/install-lmdb-linux.sh:
: not found install/install-lmdb-linux.sh:
-e

Installing LMDB

Cloning into 'lmdb'...
: not found install/install-lmdb-linux.sh:
make: Entering directory '/root/bystro/lmdb/libraries/liblmdb'
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized   -c mdb.c
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized   -c midl.c
ar rs liblmdb.a mdb.o midl.o
ar: creating liblmdb.a

This shell script seems to be failing, but somehow recovers (?) and build continues to:

Step 11/13 : RUN . install/install-go-packages.sh
 ---> Running in 7700bf77c2b1
: not found install/install-go-packages.sh:
-e

Installing go packages (bystro-vcf, stats, snp)

: not found install/install-go-packages.sh:
: not found install/install-go-packages.sh:
: not found install/install-go-packages.sh:
Made /root/go path
: not found install/install-go-packages.sh:
: not found install/install-go-packages.sh:
: not found: install/install-go-packages.sh:
: not found: install/install-go-packages.sh:
: not found: install/install-go-packages.sh:
: not found: install/install-go-packages.sh:
: not found: install/install-go-packages.sh:
: not found: install/install-go-packages.sh:
The command '/bin/sh -c . install/install-go-packages.sh' returned a non-zero code: 127

This script is the point at which build fails with exit code 127 (command not found). The task of this script is basically just to ‘go install’ some dependencies for the app.

My Debug:

After messing around with variations of the two RUN functions, I finally decided to log some of the situation: I check to see if the two shell scripts were actually present at runtime, and to see if Go was present at runtime. Both were present.

Step 9/15 : RUN ls install/
 ---> Running in 0f0ad051b009
export-bystro-libs.sh
export-go-path-linux.sh
install-apt-deps.sh
install-go-linux.sh
install-go-mac.sh
install-go-packages.sh
install-liftover-linux.sh
install-lmdb-linux.sh
install-mac-deps.sh
install-perl-libs.sh
install-perlbrew-linux.sh
install-rpm-deps.sh
update-packages.sh
Step 12/15 : RUN go version
 ---> Running in b8b9d08ef9c3
go version go1.11 linux/amd64

Also, note, both scripts execute perfectly when I run them manually.

Question:

Why is my build failing? It seems like Docker has the scripts, the tools to execute them, and the proper instruction to do so, so I’m not sure how to approach this.

Source: StackOverflow