Search code examples
dockerdocker-for-windowsdocker-desktop

Docker Desktop for Windows -- How to specify an executable entrypoint?


What is the correct syntax for specifying an executable entrypoint? For instance, I build a project which produces an executable (e.g. "example.exe") which gets copied to the docker container under C:\app. I cannot seem to get the Dockerfile entrypoint correct, it always fails always relating to not being able to find the specified exe, the path being invalid, etc. The Dockerfile looks like:

FROM microsoft/aspnet:4.6.2-windowsservercore  
ARG source=.  
WORKDIR /app  
COPY $source .   
ENTRYPOINT ["/app/example.exe"]

I've tried numerous strings in the entrypoint:

  • example.exe
  • C:\\app\\example.exe
  • /app/example.exe

none of these strings work so I'm confused on how to run that exe as the entrypoint.

Or perhaps I'm misunderstanding the use of "entrypoint" and I need to use something else like "run"?


Solution

  • I had to use the "shell" form:

    FROM microsoft/aspnet:4.6.2-windowsservercore
    ARG source=.
    WORKDIR /app
    COPY $source .
    ENTRYPOINT "example.exe"