Preface
This is my first time to write this technical document in English, maybe it has some grammar or explanation errors, pointed out and tell me, thank you from the bottom of my heart.
Let’s proceed with our topic. As we know, .Net technology comes from Microsoft, in early period, this technology only can be used in Windows, but as the Open Source respective is becoming more and more popular, Microsoft changed attitude towards it. With the help of Mono, .Net Application can be run not only on Windows but also on Linux and Mac OS.
Docker is a small and convenience cloud compute framework feverish to developers.It puts forward a concept of container and provides a simple mechanism to run and manage each container. For instance, if we want to run a hello-word application in a Docker container, we just type docker run hello-word in terminal, the hello-word is an image will be run (or pull &run) in a container. Microsoft has seen the prospect. They built an image called microsoft/aspnet in Docker Hub which will be helpful to deploy our .Net application on Docker.
Some methods reference to
http://www.open-open.com/lib/view/open1422492505689.html
Martin Huang
Preparation
Download aspnet Resource
Type https://github.com/aspnet/Home/tree/glennc/rc2 into your browser address bar, and then press Enter
Then chose Clone or download and click Download ZIP
Wait a moment until the download task finished.
Upload the source into your Docker Server
Login your Docker Server by means of the WinSCP
Then, go into ubuntu directory, create a folder named aspnet at the same time.
Next, extract the file Home-glennc-rc2.zip we downloaded just now to the Desktop and drag the folder Home-glennc-rc2 INTO aspnet which in our Docker Server
Install
Pull the microsoft/aspnet:1.0.0-rc1-update1-coreclr image
Type the Docker Command below into your Putty terminal
sudo docker pull microsoft/aspnet:1.0.0-rc1-update1-coreclr
Note:
The image will be pulled SLOWLYbecause of the Chinese Internet.
Be patient!
You may see the terminal like the picture below.
After pulling successfully, you can use the command docker images to see the microsoft/aspnet image.
Write Dockerfile
Enter the director ~/aspnet/Home-glennc-rc2/samples
Explore the structure of the directory, use ls instruction
We chose 1.0.0-rc1-update1 and go into the sub directory HelloWeb
Use the vi Dockerfile instruction to edit Dockerfile
Transfer the FIRST line INTO:
FRO Mmicrosoft/aspnet:1.0.0-rc1-update1-coreclr
The document finally may be like this:
Save & exit
Build the hello-asp image
Use the command docker build -t hello-asp . to build
Note:
Be patient!
The process look like the picture below
If you see Successfully built XXX at the end of the process, congratulations!
Enjoy
Now you can type the command below inPutty and expose the PORT 8087(ifnot be allocated) in console.qcloud.com Security Groups
sudo docker run -t -d -p 8087:5004 hello-asp
Verify through your browser by type ip:8087