centos7.x Docker Run ASP. NET core2.x Project

Source: Internet
Author: User
Tags dotnet docker run

Within Windows:

Make a vs2017 (15.8 version) new. NET Core Project ASP. Project template ASP. core2.1 No Docker support (because Docker support under Windows is a hassle) HTTPS is on, but when it is released to Linux by default, it seems to be HTTP at last;

New project WebApplication1, commissioning words

Https://localhost:5001/api/values will return a JSON file content is

["Value1", "value2"];

Publish (new configuration file):

Publish method: Select File system;

Settings: Release;

Target frame: I am netcoreapp2.1 for the time being;

Deployment mode: Choose Independent, published, the overall document more, larger, I am currently measured is probably 93mb+;

Select frame depends on, publish, the overall file number is very small, measured less than 2MB large;

Because it is released to centos7.x Docker so the target movement: linux-x64;

Publish the default file under Project folder \bin\release\netcoreapp2.1\publish

Linux:

Package the files under Windows Publishing directory Publish, transfer them to Linux, and unzip them to/dotnet;

Deployment Mode Select Standalone:

chmod U+x/dotnet/webapplication1

Docker run-dit--restart=always--name=dotnet-p 80:80-v/dotnet:/dotnet--hostname dotnet microsoft/dotnet:2.2-runtime /dotnet/webapplication1;

Microsoft/dotnet:2.2-runtime image size 180.5MB;

Plus the project document 93mb+, a total of 273mb+ large;

Deployment mode Selection Framework dependencies:

Docker run-dit--restart=always--name=dotnet-p 80:80-v/dotnet:/dotnet--hostname dotnet microsoft/dotnet:2.2-aspnetc Ore-runtime dotnet/dotnet/WebApplication1.dll;

Microsoft/dotnet:2.2-aspnetcore-runtime image size 257.8MB;

Plus project Document 2mb-, a total of 259mb large;

My advice is to choose the second way, the package is relatively small oh, and I saw vs2017 to add to the project Docker support Dockerfile from the bottom package, is aspnetcore-runtime;

centos7.x Docker Run ASP. NET core2.x Project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.