Comment faire pour exécuter un script bash dans une Alpine conteneur Docker

J'ai un répertoire contenant seulement deux fichiers, Dockerfile et sayhello.sh:

.
├── Dockerfile
└── sayhello.sh

La Dockerfile lit

FROM alpine
COPY sayhello.sh sayhello.sh
CMD ["sayhello.sh"]

et sayhello.sh contient simplement

echo hello

La Dockerfile construit avec succès:

kurtpeek@Sophiemaries-MacBook-Pro ~/d/s/trybash> docker build --tag trybash .
Sending build context to Docker daemon 3.072 kB
Step 1/3 : FROM alpine
 ---> 665ffb03bfae
Step 2/3 : COPY sayhello.sh sayhello.sh
 ---> Using cache
 ---> fe41f2497715
Step 3/3 : CMD sayhello.sh
 ---> Using cache
 ---> dfcc26c78541
Successfully built dfcc26c78541

Cependant, si j'essaie de run, je reçois un executable file not found in $PATH erreur:

kurtpeek@Sophiemaries-MacBook-Pro ~/d/s/trybash> docker run trybash
container_linux.go:247: starting container process caused "exec: \"sayhello.sh\": executable file not found in $PATH"
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"sayhello.sh\": executable file not found in $PATH".
ERRO[0001] error getting events from daemon: net/http: request canceled 

Quelqu'un peut m'expliquer quelle en est la cause? (Je me souviens de l'exécution de scripts dans debian:jessieà base d'images d'une manière similaire, il est peut-être Alpin-spécifique)?

OriginalL'auteur Kurt Peek | 2017-06-28