Docker Deployment Netcore Interface (iii)

Source: Internet
Author: User
Tags dotnet

The first two articles introduce some basic concepts and environments for Docker, so let's learn how to run a well-developed net Core interface project in Docker.

This article does not focus on security information, so before you do so, turn off the firewall

The overall process is relatively simple and can be divided into 3 steps:

    • Pull the base image microsoft/dotnet
For the underlying image, you can understand that as a mirror template, we create our own custom images, all from the underlying image to be modified.

Docker Pull Microsoft/dotnet:latest

    • Build a custom image

1, publish the interface project, upload the project code to the specified path such as: root/docker/

2. Create the Dockerfile file and upload the Dockerfile to the Code directory

From microsoft/dotnet:latest   #自定义的镜像来源于基础镜像 microsoft/dotnet:latest/app   # Working directory in the container copy                         /app/ # Copy the app file to root  from the current host directory "." Copy to Container mirror directory "/app/ "
/TCP  # Configure The listening port to
entrypoint  ["dotnet""/app/dockertest.dll"] # Start the app 

3, compile their own image named "Netcoretest"

Docker build-t netcoretest./

    • Run the image and map the extranet port to the container port (extranet: Intranet)
netcoretest:

Note here that in Program.cs, be sure to listen to any address, otherwise the request address will be rejected

1   Public class Program2     {3          Public Static voidMain (string[] args)4         {5 buildwebhost (args). Run ();6         }7 8          Public StaticIwebhost Buildwebhost (string[] args) =9 Webhost.createdefaultbuilder (args)Ten. Usestartup<startup>() One                    . Useurls ("http://*:5000")  A                     . Build (); -}

Https://help.aliyun.com/document_detail/51853.html

http://blog.csdn.net/remote_roamer/article/details/51916893

Http://www.runoob.com/docker/docker-image-usage.html

Http://www.docker.org.cn/book/docker/prepare-docker-5.html

Http://www.cnblogs.com/jRoger/p/aspnet-core-deploy-to-docker.html

Http://www.cnblogs.com/baiyunchen/p/5812110.html

Docker Deployment Netcore Interface (iii)

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.