![]() ![]() Once that bug above is fixed, it'll get hit and routed like any container. The workaround is to get the IP address of the container from docker like this: docker inspect -f "" afa I'll report back once I hear more about this bug and how it gets fixed. Today you have to hit the IP of the container directly. NOTE: There's a bug as of this writing that affects how Windows 10 talks to Containers via "NAT" (Network Address Translation) such that you can't easily go like you (and I) want to. Then I'll run it, mapping the ports from Windows outside to the Windows container inside! >docker build bin\Debug\netcoreapp1.0\publish -t aspnetcoreonnano I can also control the ports that ASP.NET talks on if I like with an Environment Variable and Expose that within Docker. I'll change my Dockerfile to use the Windows Nano Server image. You can check for Containers in Features: You may not know that you likely already have Windows Containers! It was shipped inside Windows 10 Anniversary Edition. So now I'm using Docker with Windows Containers. With the new Docker for Windows you can just right click on it and switch between Linux and Windows Containers. Michael Friis from Docker has a great blog post on building and running your first Docker Windows Server Container. Certainly, since Nano is very capable, I could run IIS within the container and there's docs on that. Let me see if I can get ASP.NET Core running on Kestrel under Windows Nano Server. This means there's a lot of great choices depending on what you need for functionality and server density. There's Windows Server, there's Windows Server Core that removes the UI among other things and there's Windows Nano Server which gets Windows down to like hundreds of megs instead of many gigs. What else can I do? ASP.NET Core in a Docker Windows Container running Windows Nano Server ![]() So I'm running Windows, running Hyper-V, running a Linux host that is hosting Docker containers. >docker run -it -d -p 85:80 aspnetcoreonlinuxġcfcc8e8e7d4e6257995f8b64505ce25ae80e05fe1962d4312b2e2fe33420413ĬONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESġcfcc8e8e7d4 aspnetcoreonlinux "dotnet WebApplicatio" 2 seconds ago Up 1 seconds 0.0.0.0:85->80/tcp clever_archimedesĪnd there's my ASP.NET Core app running in Docker. >docker build bin\Debug\netcoreapp1.0\publish -t aspnetcoreonlinuxĪspnetcoreonlinux latest dab2bff7e4a6 28 seconds ago 276.2 MB I'll publish, then build the images, and run it. This optimizes server density and resource. ![]() Be sure to read Steve Lasker's blog post " Building Optimized Docker Images with ASP.NET Core" to learn how to have one docker container build your app and the other run it it. ![]() Next, since I don't want Docker to do the building of my application yet, I'll publish it locally. FROM microsoft/aspnetcore:1.0.1ĮNTRYPOINT Starting from my ASP.NET Core app, I'll make sure my base image (that's the FROM in the Dockerfile) is the base ASP.NET Core image for Linux. Out of the box, I'm all setup to deploy my ASP.NET Core app to a Docker Linux container. This adds a basic Dockerfile and some docker-compose files. This menu comes from the Visual Studio Tools for Docker extension. Then I right click and Add | Docker Support. I'll say File | New Project and make a new ASP.NET Core application running on. I'll do everything from the command line or from Visual Studio. There's my Linux host that I don't really have to think about. Docker for Windows (I used the Beta Channel)ĭocker for Windows is really nice as it automates setting up Hyper-V for you and creates the Docker host OS and gets it all running.NET Core 1.0.1 - VS 2015 Tooling Preview 2 I wanted to see how things are looking with ASP.NET Core, Docker, and Windows here in October of 2016. In May of 2016 Docker for Windows Beta continued to move the ball forward nicely. Later in December of 2015 new tools like Docker Toolbox and Kitematic made things even easier. I wrote a blog post showing how to publish an ASP.NET 5 (5 at the time, now Core 1.0) app to Docker. In May of last year doing things with ASP.NET and Docker was in its infancy. ![]()
0 Comments
Leave a Reply. |