I am trying to dockerize a cpp
application and after i build the image in docker and run it i get an error.
Error:
/bin/sh: 1:home/simple/Main: not found
main.cpp
#include<iostream>
int main(){
std::cout<<"Hellow World";
return 0;
}
I compile this with : `g++ -o Main main.cpp`
Dockerfile
FROM ubuntu:latest
RUN mkdir -p /home/simple
COPY . /home/simple
CMD home/simple/Main
Docker commands
docker build -t myapp .
docker run myapp
P.S I have followed this guide :https://www.youtube.com/watch?v=kejsVBoP4kE
How can it not find the executable
since it it is in the same folder with the Dockerfile
.When i run COPY . /home/simple
could it somehow happen to copy only 1/2
of the files?
P.S.2 After setting the ENTRYPOINT ["ls","-l","/home/simple/"]
the returned files were 0
.
It seems that the ADD/COPY . /home/simple/
does not work.No files are copied.
CMD /home/simple/Main
?COPY
command does not work.I have used as an entrypointENTRYPOINT ["ls","-l","/home/simple/"]
and there are no files in.I have also tried theADD src dest
version and still it does not copy anything in the image.WORKDIR /home/simple
. Or your current path is wrong.