2

I have a .net Core 2.1 console application and I want to build it into a docker container that will be deployed to Linux (Alpine).

If this had an output on windows of an exe (and was self-contained of course). My docker file might look like this:

COPY  /output/ /bin/
CMD ["/bin/sample.exe"]

As I want to make this a portable app (and have .net Core Runtime on the Linux box already), should my docker file look like this:

FROM microsoft/dotnet:2.1-runtime

COPY  /output/ /bin/
CMD ["dotnet", "/bin/sample.dll"]

Thanks for any advice in advance!

Rob
  • 6,819
  • 17
  • 71
  • 131

1 Answers1

4

Yes, Microsoft has a dotnet docker samples repository. Their Dockerfile looks like to following:

FROM microsoft/dotnet:2.1-runtime
COPY /output /bin/
ENTRYPOINT ["dotnet", "/bin/dotnetapp.dll"]

They also have a alpine based example of a Dockerfile

For more information on Entrypoint / CMD

mschuurmans
  • 1,088
  • 1
  • 12
  • 24