Closed jr-chainguard closed 1 year ago
Tagging @imjasonh
I suspect it is because we need to add /app to the PATH variable. What happens when you do:
environment:
PATH: "/bin:/usr/bin:/sbin:/usr/sbin:/app"
Is an image's entrypoint
supposed to be executed in terms of its workingDir
? I guess not:
$ cat Dockerfile
FROM alpine
WORKDIR /app
RUN echo "echo hi" > entrypoint.sh && chmod +x entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
$ docker build -t test . && docker run --rm test
...
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "entrypoint.sh": executable file not found in $PATH: unknown.
Changing that to ENTRYPOINT ["/app/entrypoint.sh"]
seems to fix it. Or adding /app
to PATH
.
Sorry for misleading you @jr-chainguard, I think this is expected behavior. Or at least it's consistent behavior, even if it's unexpected.
Fully specifying the entrypoint path or adding it to PATH
should fix it.
An example:
With these two specifications, the .sh is found and executed without issue:
With these two specifications, the .sh file is not found at container runtime:
docker run: