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!

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.