Article byKallie Bracken and Jason Messer

The containers revolution popularized by Docker has come to windows so that developers on Windows 10 ( Anniversary Edition ) or IT Pros using Windows Server 2016 can rapidly build, test, and deploy Windows “containerized” applications!

Based on community feedback, we have made several improvements to the Windows containers networking stack to enable multi-container, multi-service application scenarios. Support for Service Discovery and the ability to create (or re-use existing) networks are at the center of the improvements that were made to bring the efficiency of Docker Compose to Windows. Docker Compose enables developers to instantly build, deploy and scale-out their “containerized” applications running in Windows containers with just a few simple commands. Developers define their application using a ‘Compose file’ to specify the services, corresponding container images, and networking infrastructure required to run their application. Service Discovery itself is a key requirement to scale-out multi-service applications using DNS-based load-balancing and we are proud to announce support for Service Discovery in the most recent versions of Windows 10 and Windows Server 2016.

Take your next step in mastering development with Windows Containers, and keep letting us know what great capabilities you would like to see next!

When it comes to using Docker to manage Windows containers, with just a little background it’s easy to get simple container instances up and running . Once you’ve covered the basics, the next step is to build your own custom container images using Dockerfiles to install features, applications and other configuration layers on top of the Windows base container images. From there, the next step is to get your hands dirty building multi-tier applications, composed of multiple services running in multiple container instances. It’s here―in the modularization and scaling-out of your application―that Docker Compose comes in; Compose is the perfect tool for streamlining the specification and deployment of multi-tier, multi-container applications. Docker Compose registers each container instance by service name through the Docker engine thereby allowing containers to ‘discover’ each other by name when sending intra-application network traffic. Application services can also be scaled-out to multiple container instances using Compose. Network traffic destined to a multi-container service is then round-robin’d using DNS load-balancing across all container instances implementing that service.

This post walks through the process of creating and deploying a multi-tier blog application using Docker Compose (Compose file and application shown in Figure 1).

Use Docker Compose and Service Discovery on Windows to scale-out your multi-serv ...

Figure 1: The Compose File used to create the blog application, including its BlogEngine.NET front-end (the ‘web’ service) and SQL Server back-end (the ‘db’ service).

Note:Docker Compose can be used to scale-out applications on a single host which is the scope of this post. To scale-out your ‘containerized’ application across multiple hosts, the application should be deployed on a multi-node cluster using a tool such as Docker Swarm. Look for multi-host networking support in Docker Swarm on Windows in the near future.

The first tier of the application is an ASP.NET web app, BlogEngine.NET , and the back-end tier is a database built on SQL Server Express 2014. The database is created to manage and store blog posts from different users which are subsequently displayed through the Blog Engine app.

New to Docker or Windows Containers?

This post assumes familiarity with the basics of Docker, Windows containers and ‘containerized’ ASP.NET applications. Here are some good places to start if you need to brush up on your knowledge:

Intro to Docker on Windows (i.e. using Docker to run Windows base containers) Microsoft MSDN:Windows Containers and Containers 101 on Channel 9 Building a containerized .NET app on Docker (i.e. using Docker to configure/deploy custom containers): Windows Containers How to Containerize an ASP.NET Web API Application in Windows using Docker Setup System Prerequisites

Before you walk through the steps described in this post, check that your environment meets the following requirements and has the most recent versions of Docker and Windows updates installed:

Windows 10 Anniversary Edition (Professional or Enterprise) or Windows Server 2016

Windows Containers requires your system to have critical updates installed. Check your OS version by running winver.exe , and ensure you have installed the latest KB 3192366 and/or Windows 10 updates.

The Windows Container Feature and Docker must be enabled/installed on your system as described in the Quickstarts below.

Make sure you are running the most recent version of Docker either Docker v1.13.0-dev or later for Windows 10 clients OR Commercially Supported (CS) Docker v1.12.2 or later for Windows Server 2016 Windows Server QuickStart Windows 10 Quickstart The latest version of Docker-Compose (available with Docker-for-Windows ) must be installed on your system.

NOTE: The current version of Docker Compose on Windows requires that the Docker daemon be configured to listen to a TCP socket for new connections. A Pull Request (PR) to fix for this issue is in review and will be merged soon. For now, please ensure that you do the following:

Please configure the Docker Engine by adding a “hosts” key to the daemon.json file (example shown below) following the instructions here. Be sure to restart the Docker service after making this change.


"hosts":["tcp://", “npipe:////./pipe/win_engine"]

} When running docker-compose, you will either need to expli

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

tags: Windows,Docker,Compose,using,your,application,container,multi
本文标题:Use Docker Compose and Service Discovery on Windows to scale-out your multi-serv ...

技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(262)