I have a directory containing only two files, Dockerfileand sayhello.sh:
.
├── Dockerfile
└── sayhello.sh
Dockerfile is reading
FROM alpine
COPY sayhello.sh sayhello.sh
CMD ["sayhello.sh"]
and sayhello.shcontains just
echo hello
Dockerfile builds successfully:
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
However, if I try runto do this, I get an error executable file not found in $PATH:
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
What causes this? (I remember running scripts on debian:jessie-based images in a similar way, so maybe this applies to Alpine)?
source
share