Docker Hello Wold – oci runtime error
I am trying to understand Docker and I have a very simple Dockerfile at
~/dockerfiles/test on my OSX.
FROM scratch RUN echo "Hello world" > ~/helloworld.txt CMD ["cat", "~/helloworld.txt"]
When I try to build an image for this file like
docker build -t simple .
I get an error during the build process.
Sending build context to Docker daemon 2.048 kB Step 1 : FROM scratch ---> Step 2 : RUN echo "Hello world" > ~/helloworld.txt ---> Running in fc772fd39d45 oci runtime error: exec: "/bin/sh": stat /bin/sh: no such file or directory
Any pointers on why I am facing this issue?
One Solution collect form web for “Docker Hello Wold – oci runtime error”
You start from SCRATCH (the empty image), you are using
cat, which is not a shell built-in.
/bin/sh to run (it will fork the process and load dynamic libraries)
Note: By default,
/bin/sh -c, but the doc “Creating a simple base image using scratch” shows that
ENTRYPOINT is empty for a scratch image.
As BMitch comments below:
The quick fix to the problem is changing from to something like
FROM debian:latestor even
FROM busybox:latestif size matters
The image currently used for that is alpine
The image is only 5 MB and has access to a package repository that is much more complete than other BusyBox based images.