1. Generating a Docker image for an ASP. NET Core Application
Download this case project: Https://github.com/dotnet/dotnet-docker/tree/master/samples/aspnetapp
When the download is complete, generate a mirror named Aspnetapp image for this project.
Docker build-t Aspnetapp.
In order to make a difference I created a a.html file in wwwroot after the Aspnetapp image was generated, and another image named Webappa was generated.
Docker build-t Webappa.
2. Create a new container for the image you just created and run
Docker run-d-P 5000:80--name WebApp Spnetapp
Docker run-d-P 5001:80--name webapp2 Aspnetapp
Docker run-d-P 5002:80--name Webappa Webappa
3. Separate visits
Note: My docker is installed on the Windows 7 Service Pack System, My Computer intranet IP is 10.0.0.203, after the installation is completed, two virtual networks are created locally, respectively, the 192.168.56 network segment and the 192.168.99 network segment
View Docker's system IP address needs to open Oracle VM VirtualBox View
Click Show Enter, enter IP addr show eth0 and IP addr show eth1 view IP address for 10.0.2.15 and 192.168.99.100
Input 192.168.99.100:5000,192.168.99.100:5001,192.168.99.100:5002 access to individual container applications
Tip: We can also enter kitematic (Alpha) to view the running container, and the access address of the container app
4. Configure Nginx to allow 10.0.0 network access
Configure the reverse proxy in Nginx to provide external network access
External network access: 10.0.0.203:81,10.0.0.203:82,10.0.0.203:83 access to individual container applications
Before creating a second Webappa mirror, I created a a.html in the Wwwroot folder to access the normal display, indicating that the direction agent is normal
Docker generates a Docker image for an ASP. NET Core application and runs multiple containers