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
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)