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 > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to deploy Asp.Net6 Core under Linux CentOS docker, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
1. Project settings
Set the dockerfile property to "always copy"
Modify the dockerfile file to:
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR / web COPY. .EXPOSE 80 EXPOSE 443FROM base AS finalENTRYPOINT ["dotnet", "OneZhanMVC.dll"]
Ps: if there is no dockerfile right click on the project, click add and select docker support.
2. Project release
Right-click the project release (publish method: file system)
3. Project transmission
Use ftp to connect to the server to transfer the published file to linux
4. Install docker5, install .net6 environment
Docker pull mcr.microsoft.com/dotnet/aspnet:6.0
6. Build an image
Cd project directory for example: cd web/onezhanmvc (cd to the directory where dockerfile is located, and the build command creates an image based on dockerfile)
Docker build-t image name. For example: docker build-t onezhanmvc. (. Don't forget)
7. Create and run containers
Docker run-d-- name my-dotnet6-demo01-p 8001VR 80-- restart=always onezhanmvc (the name of the image created in the previous step)
Parameter description:
-d # running in the background
-p 8001VR 80 # host port number: docker port number
-- restart=always # dokcer also starts the container automatically when it is restarted
Normally, we can access the IP+ port number of linux externally.
8. Common container commands
View all containers: docker ps-a
Startup container: docker start container name
Restart container: docker restart container name
Stop container: docker stop container name
Delete container: docker rm container name
Delete image: docker rmi image name
These are all the contents of the article "how to deploy Asp.Net6 Core in docker under Linux CentOS". 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.