Win10 and Mac stable version of Docker released, before looking at the next Xu Lei teacher's several docker4dotnet articles http://devopshub.cn/2016/07/08/ Docker4dotnet-1-overview-and-helloworld/, but never did. Lazy cancer is late.
Prepare a dotnet Core Web application, test it, and make minor changes.
To verify the environment of the current host in order to run, no other meaning
By the way, you can specify the next program entry, at startup, through the command line to specify a listening port:
iconfiguration config = new Configurationbuilder () . Addcommandline (args) . Build (); var host = new Webhostbuilder () . Useconfiguration (config) . Usekestrel () . Usecontentroot (Directory.GetCurrentDirectory ()) . Usestartup<startup> () . Build ();
Then simply restore the next reference, then publish a test
Run it and prove that the code can run normally. And it's running under my machine:desktop-078ua43.
Test the Docker
pull off the dotnet core image after installing Docker Docker Pull Microsoft/dotnet:latest
You can then wear a dockerfile under the project root to fill in the information you want to package:
From microsoft/dotnet:latest# Set, the working directoryworkdir./app # Configure The listening port to the EXPOSE 5006 # Co PY the appcopy/bin/debug/netcoreapp1.0/publish//app/ # Start The Appentrypoint dotnet DotNetCoreSample.dll-- Server.urls
Then it can be packaged and run (Docker run-d-P 5008:5004 coresample can be registered as a background process)
Visit the next http://localhost:5008/Home/About to see that the operating environment is already in the container.
WINDOWS10 application Docker Deployment Donet Core