Docker ASPNetCore https four steps to teach you to build a website

sequence

This tutorial requires that they have a good certificate application, no certificate please refer to the official tutorial . Docker is not to say, as long as we know how to use.

 

surroundings

 core:asp net core 2.2

Development machine: win10 LTS 

Server: window Server 2019 (here should give me an excuse cap)

 Reference: Hosting with ASP.NET Core ImagesRF Royalty Free Docker over HTTPS    trouble did not understand the give me a praise (ಥ_ಥ)

 

go

Development machine:

1, create a project aspnetcore

I have here named "zlyxm.DockerAspNetCoreHttps"    (っ̯ -.) 

 

 

 

Once created will docker environmental inspection, it goes without tube

  

 

2. generation docker video?

  

Waiting for the completion of generation

 

 Remember mirror name generated  zlyxmdockeraspnetcorehttps  step 4 will be used

 

3. certificate configuration

In the Run "% USERPROFILE% \. Aspnet \ https \" open the certificate store directory

Your SSL certificate into this directory, where the certificate name to "2761828_www.xxxxxxx.com.pfx" for example.

 

4, command line to run docker

 docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORT=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="zlyxmpassword" -e ASPNETCORE_Kestrel__Certificates__Default__Path=\https\2761828_www.xxxxxxx.com.pfx -v %USERPROFILE%\.aspnet\https:C:\https\ zlyxmdockeraspnetcorehttps

 

 Then the page opens https: // localhost: 8001

 

 

Enter your computer IP + 8001 can also be accessed in the LAN. (Your computer firewall did not open the case)

You can also customize the name, run behind the command's certificate name to the name of your certificate on the line

 

 Export Mirror

At the command line, press Ctrl + C to exit first, input

docker save -o D:\zlyxm.tar zlyxmdockeraspnetcorehttps

I am here to save the file location is "D: \ zlyxm.tar", you do it ourselves

 

 

5, server deployment

Development unit is operating properly can be the next step, server deployed.

The server must environment: Docker for Windows Installer

        Send your certificate to the directory server, and here I certificate named "2761828_www.xxxxxxx.com.pfx", on the server directory is "C: \ Users \ Administrator \ Desktop \ https"

            dotnet-sdk-2.2.401-win-x64

 

(2) environment to build

Most Internet-based deployment method HUB, we are here to deployment export and then sent to the server based on the development of simple machine image.

Build server can also be deployed in accordance with https://blog.csdn.net/aqtata/article/details/83044616

 

The development machine to send the exported .tar image files to the server, the server is running

docker load --input C:\Users\Administrator\Documents\U\zlyxm.tar

"C: \ Users \ Administrator \ Documents \ U \ zlyxm.tar" directory to your file path

 

(3) to run the server

docker run --rm -it -p 80:80 -p 443:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORT=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="2761828_www.xxxxxxx.com.pfx" -e ASPNETCORE_Kestrel__Certificates__Default__Path=\https\2761828_yichude.com.pfx -v %USERPROFILE%\.aspnet\https:C:\https\ zlyxmdockeraspnetcorehttps

 

 

 

 

 

 

 

 

Open your browser

 

 

 

There is a big problem during the various Access is denied, the server may be on the C: \ Users \ Administrator \ Desktop \ https not have access to the results

 

 

Various queries without fruit, dead horse a living horse medicine, add the Everyone permissions, I think every minute to Pibi.

 

 

 

 

 

Quickly run, run up! I quickly turned off again scared Everyone permissions, go into the specific reasons later. .

 

 Ah ah ah ah, to die, typesetting completely chaotic, quickly slipped on the matter, anxious to project

 

Another heard docker -v mount the file is used to develop, Mother Goose Wood wood, there is a message to inform chiefs seek proper build environment pose! !

+1 other, docker run --rm -it -p development model is generally used here only to do to get started.

I also did two weeks just to get docker, certainly a lot of wrong place, everyone guide! !

Guess you like

Origin www.cnblogs.com/zlyxm/p/11482256.html