I am trying to create an image with my binary file (written in Rust) but I get different errors. This is my
FROM scratch COPY binary / COPY .env / COPY cert.pem /etc/ssl/ ENV RUST_BACKTRACE 1 CMD /binary
Building finishes fine but when I try to run it I get this:
$ docker run binary docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: "/bin/sh": stat /bin/sh: no such file or directory": unknown. ERRO error waiting for container: context canceled
$ docker run binary /binary standard_init_linux.go:195: exec user process caused "no such file or directory"
I have no idea what to do. The error message looks very odd to me. According to the official docker documentation it must work so.
System info: latest archlinux, docker:
Docker version 18.02.0-ce, build fc4de447b5
P.S. Tested the same with C++ – works fine, with both clang and gcc.
P.P.S. It does not work with
-based images. But it works withpostgresql
,debian` images. So the problem exactly in something related to rust and lightweight docker images – everything works okay otherwise.