4

I am facing problem when I build and run my image. here is my docker file code.

FROM microsoft/nanoserver
MAINTAINER sagar@gmail.com
COPY name.exe /bin/
ENTRYPOINT ["name.exe/bin"]
CMD ["/bin/name.exe", "input1", "output"]

To build I am using this : docker build -t my name .

When I build it it shows successfully but when I run this it is not giving any output or any error. I have tried with other base images also.

meatspace
  • 859
  • 16
  • 25
Sagar
  • 51
  • 1
  • 8
  • Docker is for Linux. You cannot run a Windows executable in it. So install Linux on your laptop, compile your program on Linux (using `gcc` for C code or `g++` for C++ code) and copy its executable into your docker. – Basile Starynkevitch Feb 25 '17 at 08:25
  • But i am rurunning this exe on Windows container..is it fine ? – Sagar Feb 25 '17 at 09:33
  • 2
    @BasileStarynkevitch, Windows containers with Docker are actually a real thing (see [Microsoft's documentation on this](https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/deploy-containers-on-nano)). Regarding the question; are you sure that `name.exe/bin` is the correct entrypoint? Since `bin/name.exe` is also in your ´CMD`, have you tried omitting the entrypoing entirely? – helmbert Feb 25 '17 at 13:03
  • What should I do ? I am not getting your point @helmbert – Sagar Feb 25 '17 at 17:56
  • How are you running it? With the `-i` (interactive) flag? If not, you won't see any output. – meatspace Feb 27 '17 at 02:55
  • i am using this command to run : docker run myimage – Sagar Feb 27 '17 at 03:22
  • Getting this error when i tried with **-i** : Docker\Resources\bin\docker.exe: Error response from daemon: container 7da4b32f71a7a0746aa472ae7c20f677ca1153cb75e05b6140a4fd8a758f120f encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"ApplicationName":"","CommandLine":"name.exe/bin / bin/name.exe input1 output","User":"","WorkingDirectory":"C:\\","Environment":{},"EmulateConsole":false,"CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe" – Sagar Feb 27 '17 at 05:39
  • That just means that your `COPY` command didn't put the file where you think it did (i.e., `name.exe` is not at `/bin/name.exe`). – meatspace Feb 27 '17 at 14:58
  • so what is the solution for that ? – Sagar Feb 28 '17 at 02:13

1 Answers1

1

I think the error is in the ENTRYPOINT line. You use the path "name.exe/bin" instead of "bin/name.exe" which is where your COPY put the file.

You actually don't need the entrypoint if you use CMD as @helmbert said. I think the difference between ENTRYPOINT and CMD is that you can override a CMD command at the run if you want. So you could use "docker run -i myimage powershell". You can try without the entrypoint line and see.

Guillaume
  • 423
  • 1
  • 4
  • 11