GoogleContainerTools / distroless

🥑 Language focused docker images, minus the operating system.
Apache License 2.0
18.64k stars 1.14k forks source link

Way to run startup shell script as part of container entrypoint command #562

Closed hussainsaify closed 4 years ago

hussainsaify commented 4 years ago

Hi Team,

I am trying to build distroless images for our micorservices that are based on play framework[https://www.playframework.com/]. I am able to create the images, but it is failing to run, as startup script(this is created by play framework during compilation) requires bash. Is it possible to run startup script as part of entrypoint?

Image- gcr.io/distroless/java:8

Error while running container-

standard_init_linux.go:211: exec user process caused "no such file or directory"

Please let me know in case you require any more details.

Thanks, Hussain

chanseokoh commented 4 years ago

See if you can get rid of the script. If you must use the script, then install any interpreter that can interpret your script language into your image. Typically various shell programs (which provide way more functionalities than just interpreting its language, unfortunately). In the following example, I use the dash binary.

FROM debian:buster AS source

FROM gcr.io/distroless/java-debian10:11
COPY --from=source /bin/dash /bin/sh