In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
docker how to run. NET Core 3.0, I believe many inexperienced people are helpless about this, this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
1. create a site
Create an ASP.NET Core Web application and check Enable Docker support. Automatically create a Dockerfile for us.
2. Writing Dockerfile
Dockerfile is a configuration file in file format that users can use to quickly build custom images. Consists of a line of command statements and supports comment lines beginning with #.
Dockerfile theme content is generally divided into 4 parts
Basic mirror information
Maintainer information using label directive
mirror operation instruction
Execute instructions at container startup
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS baseWORKDIR /appEXPOSE 80COPY . .ENTRYPOINT ["dotnet", "AA.Mvc.dll"]
Dockerfile directive description:
FROM -Specifies the base mirror of the mirror being created
WORKDIR-Configure Work Directory
EXPOSE-Declares the port on which services within the image listen
COPY-Copy content to mirror
ENTRYPOINT-Default population command to start mirroring
Compile and publish web projects
3. Site publishing, xftp upload centos
Upload to centos using xftp
4. Build images, run containers and browse
4.1 To create an image, you can use the command docker build, as follows:
docker build -t core-mvc .
Parameter decomposition:
-t ---Specify the mirror name
At the end of the command. ---indicates that the build context is the current directory, docker will use Dockerfile found in the root directory of the context by default
4.2 To view the list of mirrors, type the command
docker images
4.3 Create and launch, view containers
docker run --name netcore-mvc -d -p 50879:80 core-mvcdocker ps -a
parameter description
-d , indicates that the container is running daemonized in the background
-p External port maps to internal container ports.
--name Specifies the container name. Of course, we can not specify, the default will be created for us
The last parameter core-mvc is the name of the mirror we just created
After the above 4 steps, enter the address http://192.168.92.130:50879 in the browser to view the figure
After reading the above, do you know how to run. NET Core 3.0 in docker? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!
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.