ok, i just did
#!/bin/bash
echo i am here
make executable
chmod +x doit2.sh
start a docker container
docker run -d --name foo - ubuntu sleep 1000
copy the script to the container, change name to insure not using host script
docker cp doit2.sh foo:doit.sh
note: this puts the file in the ROOT, which is NOT in the PATH list (liux for security)
exec script
docker exec foo doit.sh
fails
sam@buildserver:~$ docker exec foo doit.sh
OCI runtime exec failed: exec failed: container_linux.go:296: starting container process caused "exec: \"doit.sh\": executable file not found in $PATH": unknown
however using explicit container path
sam@buildserver:~$ docker exec foo ./doit.sh
works
i am here
check file in container
docker exec ls doit.sh -laF
returns
-rwxrwxr-x 1 1000 1000 29 Feb 7 12:06 doit.sh*