I am trying to create a base image following the instructions given in official docker webpage(https://docs.docker.com/samples/library/scratch/)
docker --version
Docker version 18.09.6, build 481bc77
OS Details:
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
DockerFile:
FROM scratch
COPY hello /
CMD ["/hello"]
hello.c
#include <stdio.h>
int main()
{
// printf() displays the string inside quotation
printf("Hello, World!");
return 0;
}
I am able to compile the C program and execute locally
I am able to build the image using the dockerfile but when I try to run the container, I get the below error:
# docker run -i hello
standard_init_linux.go:211: exec user process caused "no such file or directory"
#
I expect the container to run successfully and print "Hello World" on console. most of the answers provided are asking to change EOL which is not applicable as we are already on Linux and not trying to run script.