-
Notifications
You must be signed in to change notification settings - Fork 6k
Building Docker Images for .NET Core Applications #984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @spboyer, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution! The agreement was validated by .NET Foundation and real humans are currently evaluating your PR. TTYL, DNFBOT; |
Please review, needs top level link. I had mentioned that this page: https://docs.microsoft.com/en-us/dotnet/articles/core/index needs a Docker Section now. cc:/ @mairaw |
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
- `microsoft/dotnet` or `microsoft/dotnet:latest` (aka sdk) | ||
- `microsoft/dotnet:onbuild` | ||
- `microsoft/dotnet:core` | ||
- `microsoft/dotnet-core-deps` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is microsoft/dotnet:core-deps right?
Excellent. We also need to add the topic to the TOC file. |
@mairaw can you point me to the TOC file? |
Sure! It's here: https://github.com/dotnet/core-docs/blob/master/docs/toc.md |
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
|
||
- `microsoft/dotnet:<version>-onbuild` : that is **microsoft/dotnet:onbuild**, contains [ONBUILD](https://docs.docker.com/engine/reference/builder/#/onbuild) triggers. The build will [COPY](https://docs.docker.com/engine/reference/builder/#/copy) your application, run `dotnet restore` and create an [ENTRYPOINT](https://docs.docker.com/engine/reference/builder/#/entrypoint) `dotnet run` instruction to run the application when the Docker image is run. While not an optimized image for production, some may find it useful to simply copy their source code into an image and run it. | ||
|
||
- `microsoft/dotnet:<version>-core-deps` : that is **microsoft/dotnet:1.0.0-core-deps**, if you wish to run self-contained applications use this image. It contains the operating system with all of the native dependencies needed by .NET Core. This image can also be used as a base image for your own custom corefx or coreclr builds. While the **onbuild** variant is optimized to simply place your code in an image and run it, this image is optimized to have only the operating system dependencies required to run .NET Core apps that have the .NET Runtime packaged with the application. This image isn't generally optimized for running multiple .NET Core containers on the same host, as each image carries the .NET Core runtime within the application, and you will not benefit from image layering. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coreclr -> CoreCLR
corefx -> CoreFX
Not sure if it would help to add links to the repos on those terms.
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
Ok, @BillWagner @mairaw that should cover everything. |
what do you think @BillWagner about the location? We're usually putting them matching their location on the TOC. So should we have a new Docker entry in the TOC? |
|
||
## Docker Image Optimizations | ||
|
||
When building Docker images for developers, we focused on 3 main scenarios |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's still this 3 here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: and it would be good to add a colon in the end too
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
@mairaw @spboyer I think we should have a section under /core for all the Docker topics. This should go there. If I understand correctly, our Docker story is tied to .NET Core and the xplat support. I'd also like to see the sample code checked in, and part of our CI build. That should be a separate PR, because we may need enhancements from @dend to build the Docker images on the CI server. It would be wise to get this published without that blocking issue. The upside of adding the sample is that customers could get the code and see how the CI build works for creating Docker images. |
Open Publishing Build Service: The pull request content has been published and here are some sample preview links:
|
I like your suggestion @BillWagner. So from the last commit, I'd just change the TOC then to match the folder structure. |
To add some color, .net core and docker isn't just an optional thing customers might do. We see docker as the new model for deployment: https://blogs.msdn.microsoft.com/stevelasker/2016/05/26/docker-containers-as-the-new-binaries-of-deployment/ |
Building Docker Images for .NET Core Applications
Summary
New article for .NET Core on Docker
In order to get an understanding of how to use .NET Core and Docker together, we must first get to know the different Docker images that are offered and when is the right use case to use them. Here we will walk through the variatons offered, build an ASP.NET Core Web API, use the Yeoman Docker tools to create a debuggable container as well as peek at how Visual Studio Code can assist in the process.
Suggested Reviewers
@glennc @SteveLasker