C Dynasty to imprison the true and False Monkey King in a container run ASP. NET Core 1.0

Source: Internet
Author: User
Tags creative commons attribution net command docker hub docker run

C Dynasty to imprison the true and False Monkey King in a container running ASP. NET Core 1.0?

Warning

The page you are currently viewing is an unauthorized reprint!
If the current version of the typographical error, go to view the latest version: Http://www.cnblogs.com/qin-nz/p/aspnetcore-run-on-mono-in-year-of-monkey.html

Tips

Updated: February 07, 2016.

Everyone Cheng/program apes, Monkey happy. I believe that many of the yuan/ape are attracted by the title, then I am going to explain the title.

Tips

This article is a semi-popular text, do not delve into the technical details.

Title explanation? ASP. NET Core 1.0?

ASP. NET Core 1.0 is a cross-platform , open-source framework for developing Web site/web APIs, formerly known as ASP. 5 (again called ASP. VNext), but not an upgraded version of ASP. It is a zero-based version.

The ASP. NET Core 1.0 is completely decoupled by splitting all the functions and modules. The source generation can be found on Github ASP.

Container?

Container technology is a virtualization technology, and the virtual machine is different: the container technology will not provide a whole operating system, it can only provide isolated program operating environment, container technology for system resources consumption is much smaller than the virtual machine.

Docker is an open-source application container engine that does not need to change the kernel, he mainly uses the operating system kernel features for virtualization, all containers run in the same kernel.

Annotations

All containers run in the same kernel, meaning that all containers must match the operating system, and Windows containers cannot run directly on Linux.

Monkey?

猴子It is the translation of Spanish words, and mono in Spanish, the word also has a lovely meaning.

And what I want to say is Mono Project.

Therefore, this article means: In 2016, create a Docker container that contains the Mono runtime environment, and then launch two instances to give you the program that runs ASP. NET Core 1.0.

Build a home for the monkeys?

First you need to install the Docker (Linux) operating environment, which is the blue part of the diagram.

Ah, this is so troublesome ... If you and I have a Microsoft Azure subscription, it's easier to create a virtual machine for Ubuntu on Docker directly.

If not, please refer to the official website documentation ...

Installing Docker on Windows

Installing Docker on Mac OS

Tips

Docker is not only Linux, but also Windows (currently in preview), that is, if you want to install the two images below.

It's just that Windows is really used, and it's generally used with the full. NET Framework instead mono .

To imprison a monkey together?

Next, with the container, you can get a monkey.

Microsoft has created a container and pre-provisioned a monkey and uploaded it to the Docker Hub, which we can use directly.

Or, we can get the code to breed monkeys from GitHub to spawn monkeys.

Installing the Mono and ASP. Run environment in Docker (Linux)

Installing the Mono and ASP. Run environment in Docker (Windows)

Create an empty ASP. NET Core Web site?

First, you need a completed ASP. NET Core 1.0 application.

For Windows users, create a new ASP. NET Core (the template name is an ASP. NET 5) Web app directly with vs2015.

Mac OS users can refer to the first half of the ASP. NET Core 1.0 app created on Mac OS.

Put some food in the container?

The container we just downloaded from the Docker Hub doesn't have our app, it's just a monkey, and it's no use for eggs. Now we're ready to add the app we just created to the container.

    • Create Dockerfile

If you're using a built-in project on Mac OS yo aspnet , you've got dockerfile, otherwise you'll need to create a file named Dockerfile in your project directory.

 from microsoft/aspnet:1.0.0-rc1-update1 COPY. /appworkdir  /appRUN["Dnu""Restore"]EXPOSE  5000/tcpentrypoint  ["Dnx", "-P", "Project.json", "web"]

Explain each line.

  • Since the Docker file system is layered, the from indicates what builds the current mirror, followed by the version number;
  • Copy is to copy the local file to Docker, . indicating the current directory;
  • Workdir specify working directory;
  • Run indicates that a program is running, followed by parameters;
  • EXPOSE indicates that a port number of Docker is exposed so that the host communicates with the container;
  • ENTRYPOINT Specifies the entry point, the first is the program, followed by the parameter.
    • Building projects
Docker build.

View the build-completed image, where the image ID is the identifier for building the completed image

Docker images

Give the image a name.

Docker tag {IMAGE ID} qinnz/wukong

Little Tricks

Mirroring is equivalent to a container's negatives, and we can create many identical containers with mirrors.

Let the true and False Monkey King at the same time to run ASP.

Well, you already have an image that needs to be run, and of course you can run multiple instances (though you can't bind to the same port).

Docker run--name monkey_king-d-P 80:5000 qinnz/wukongdocker run--name his_dobule-d-p 81:5000 {IMAGE ID}

We started 2 instances in the background ( -d a true monkey king, a dummy monkey), and mapped the 5000 ports of the two containers (which can be identified by TAG or IMAGE ID) to the 80 and 812 ports of the host.

At this point, we create a Docker container that contains the Mono runtime environment, and then let it give you the program that runs ASP. NET Core 1.0.

More resources?

ASP. NET Official documentation

Create and run an ASP. NET Core 1.0 Web site on Mac OS

A. NET command-line program created on Mac OS X accesses the database (using entity Framework 7)

Docker

Docker Documentation

Statement

C dynasty to imprison the true and False Monkey King in a container . The ASP. NET Core 1.0 is created by diligent children and licensed under the Creative Commons Attribution-NonCommercial use-no derivative of the 4.0 International License Agreement.
Permission for use other than authorized by this License agreement may be obtained from HTTP://SPACE.CNBLOGS.COM/MSG/SEND/QIN-NZ.

Dynasty The true and False Monkey King in a container running ASP. NET Core 1.0

Related Article

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.