Skip to content

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

Merged
merged 18 commits into from
Sep 1, 2016

Conversation

spboyer
Copy link
Contributor

@spboyer spboyer commented Aug 30, 2016

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

@dnfclas
Copy link

dnfclas commented Aug 30, 2016

Hi @spboyer, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

@spboyer
Copy link
Contributor Author

spboyer commented Aug 30, 2016

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.
@glennc @SteveLasker

cc:/ @mairaw

@qinezh
Copy link
Contributor

qinezh commented Aug 30, 2016

Open Publishing Build Service: The pull request content has been published and here are some sample preview links:

@qinezh
Copy link
Contributor

qinezh commented Aug 30, 2016

Open Publishing Build Service: The pull request content has been published and here are some sample preview links:

@qinezh
Copy link
Contributor

qinezh commented Aug 30, 2016

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`
Copy link

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?

@mairaw
Copy link
Contributor

mairaw commented Aug 30, 2016

Excellent. We also need to add the topic to the TOC file.

@spboyer
Copy link
Contributor Author

spboyer commented Aug 30, 2016

@mairaw can you point me to the TOC file?

@mairaw
Copy link
Contributor

mairaw commented Aug 30, 2016

@qinezh
Copy link
Contributor

qinezh commented Aug 30, 2016

Open Publishing Build Service: The pull request content has been published and here are some sample preview links:

@qinezh
Copy link
Contributor

qinezh commented Aug 30, 2016

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.
Copy link
Contributor

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.

@qinezh
Copy link
Contributor

qinezh commented Aug 31, 2016

Open Publishing Build Service: The pull request content has been published and here are some sample preview links:

@qinezh
Copy link
Contributor

qinezh commented Aug 31, 2016

Open Publishing Build Service: The pull request content has been published and here are some sample preview links:

@spboyer
Copy link
Contributor Author

spboyer commented Aug 31, 2016

Ok, @BillWagner @mairaw that should cover everything.

@mairaw
Copy link
Contributor

mairaw commented Aug 31, 2016

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
Copy link
Contributor

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

Copy link
Contributor

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

@qinezh
Copy link
Contributor

qinezh commented Aug 31, 2016

Open Publishing Build Service: The pull request content has been published and here are some sample preview links:

@qinezh
Copy link
Contributor

qinezh commented Aug 31, 2016

Open Publishing Build Service: The pull request content has been published and here are some sample preview links:

@qinezh
Copy link
Contributor

qinezh commented Aug 31, 2016

Open Publishing Build Service: The pull request content has been published and here are some sample preview links:

@BillWagner
Copy link
Member

BillWagner commented Sep 1, 2016

@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.

@qinezh
Copy link
Contributor

qinezh commented Sep 1, 2016

Open Publishing Build Service: The pull request content has been published and here are some sample preview links:

@spboyer spboyer merged commit ac78556 into dotnet:master Sep 1, 2016
@mairaw
Copy link
Contributor

mairaw commented Sep 1, 2016

I like your suggestion @BillWagner. So from the last commit, I'd just change the TOC then to match the folder structure.

@SteveLasker
Copy link
Contributor

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/
We'd like to position .NET Core as the best framework for container development. We already have data that shows .NET Core can process far more requests than node. We're working on chasing GoLang for startup performance. Having docker as a first class entry point will help us pop this message.

@spboyer spboyer deleted the docker branch September 1, 2016 18:02
This was referenced Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants