In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you the "sample analysis of ASP.NET Core sites running in Docker", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and study the "sample analysis of ASP.NET Core websites running in Docker".
As a new generation of virtualization, Docker will certainly be widely used in the future. The deployment of traditional virtual machines needs a lot of operation and maintenance manpower to ensure the consistency of development environment, test environment, UAT environment and production environment. With Docker, we can deploy once and run everywhere.
Software environment list
CentOS 7.3.1611
Docker 1.12.6
.NET Core 1.1
Install Docker
$# install Docker$ yum install docker$ # start docker service $systemctl start docker.service$ # configure boot $systemctl enable docker.service
Configure Docker Accelerator
For well-known reasons, if you want to use Docker smoothly, you need to configure Docker accelerator, otherwise you will feel like you are back to the era of dial-up Internet access.
I use DaoCloud, which is claimed to be forever free. The registered address is https://account.daocloud.io/signin.
You can quickly complete registration with a scan with Wechat.
After registration, a configuration script address is provided:
$# configure docker accelerator $curl-sSL https://get.daocloud.io/daotools/set_mirror.sh | sh-s http://xxxxxx.m.daocloud.io$ # restart takes effect $systemctl restart docker
Pull ASP.NET Core image
$docker pull microsoft/aspnetcore$ # check for success $docker images
Prepare the ASP.NET Core website release file
You can refer to my previous article: publishing the ASP.NET Core website to the Linux server
Create Dockerfile
Put it in the root directory of the website. The contents of the file can be referenced as follows:
FROM docker.io/microsoft/aspnetcoreCOPY. / publishWORKDIR / publish EXPOSE 8080CMD ["dotnet", "TestAspNetCoreWeb.dll"]
Package image
$# notice that there is one last point. $docker build-t test-netcore:1.0.
Start the container
$docker run-- name test-netcore-p 8080 test-netcore:1.0 8080-d $# check whether the container is started successfully. If it doesn't work after startup, try docker run without adding-d. If there is an error, there is a message. $docker ps
The website runs successfully.
Attached
During the configuration process, I encountered two cases in which the container failed to start:
1. The monitoring of the website uses ip and reports an error of "Error-99 EADDRNOTAVAIL address not available".
two。 Localhost is used to monitor the website, and the error "curl: (56) Recv failure: Connection reset by peer" is reported.
Finally, it is found that the use of http://*:8080 to monitor is successful.
Running docker run again after a failure indicates that the name already exists. You can use docker rm-f [Container name] to delete the container or change the name.
The above is all the contents of the article "sample Analysis of the ASP.NET Core website running in Docker". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.