Skip to content

Commit

Permalink
updating the README.md to have real content and the individual direct…
Browse files Browse the repository at this point in the history
…ory landing pages.
  • Loading branch information
ManoMarks committed Apr 21, 2016
1 parent 0cd2d05 commit 67debcf
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 58 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#labs
# Docker Tutorials and Labs

This repo contains [Docker](https://docker.com) tutorials and links to tutorials on other sites.

For tutorials on other sites, check out [Docker Tutorials from the Community](community-tutorials.md).

Currently we have two Docker [Microsoft and ASP.NET tutorials](windows/windows.md) and one Docker [Java tutorial](java/readme.adoc)

We also encourage you to submit your own own tutorials by adding pull requests to this repo. If your pull requests are accepted, they will be under the same [license](LICENSE), and may at Docker's discretion become part of our official documentation, for instance on [https://docs.docker.com].
20 changes: 9 additions & 11 deletions windows/dotnet-core/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
+++
title = "Run .NET Core in Linux Container "
<!--- +++
title = "Run .NET Core in a Linux Container "
description = "Sample .NET Core"
keywords = ["beginner, tutorial, Docker"]
[menu.main]
identifier = "dotnetcore_linux"
weight = 1
+++


+++ -->
#Quickstart .NET Core
This quickstart assumes you have a working installation of Docker Engine. To
verify Engine is installed, use the following command:
Expand All @@ -18,8 +16,8 @@ $ docker info
```

# Get ASP.NET Core Samples
There are 3 samples presently provided in this github repo: A simple console
application, a simple web application with a single static welcome page, and an
There are 3 samples presently provided in this github repo: A simple console
application, a simple web application with a single static welcome page, and an
MVC web application skeleton.

In the example below, you'll use the MVC web application, "HelloMVC".
Expand All @@ -31,11 +29,11 @@ $ git clone https://github.com/aspnet/Home.git aspnetcore
# Modify ASP.NET Core Sample to use CoreClr
As described in [Choosing the Right .NET For You on the Server]
(http://docs.asp.net/en/latest/getting-started/choosing-the-right-dotnet.html),
there are two runtime choices which run on Linux, .NET Core (aka CoreCLR) and Mono.
there are two runtime choices which run on Linux, .NET Core (aka CoreCLR) and Mono.
The CoreCLR is the Microsoft-supported runtime, which you'll use in this example.

The sample Dockerfiles are presently configured to use the mono framework.

To instead use the CoreClr framework, you must modify the Dockerfile to specify
the Docker Hub CoreClr base image instead of the mono base image:

Expand Down Expand Up @@ -81,7 +79,7 @@ $ docker run -d -p 5004:5004 hellomvc-coreclr
If using a Linux host with a desktop environment such as Ubuntu desktop or Xfce,
you can open the application via [localhost:5004](http://localhost:5004)

If using docker-machine, you can get the IP as follows, with which you can then
If using docker-machine, you can get the IP as follows, with which you can then
access the site on port 5004 from a browser on the host:
```
$ docker-machine ip default
Expand Down
93 changes: 47 additions & 46 deletions windows/dotnet-linux-het/swarm.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@

# Running a Heterogeneous Azure-hosted Swarm Cluster
_with both Linux and Windows nodes_

# Introduction
This tutorial will show you how to build an Azure-hosted Swarm cluster
including both a Linux node and a Windows node, then deploy and run an
This tutorial will show you how to build an Azure-hosted Swarm cluster
including both a Linux node and a Windows node, then deploy and run an
application comprising Linux and Windows Containers on the Swarm.

It demonstrates using a Docker client running on Windows to interact with
the Swarm cluster, utilizing the Azure CLI to provision the Swarm manager
and node host VMs. The same approach may be used on Mac OS X or Linux, since
and node host VMs. The same approach may be used on Mac OS X or Linux, since
the Azure CLI is available on those platforms as well.

Here is the sequence of steps you'll follow:
Expand All @@ -18,15 +19,15 @@ Here is the sequence of steps you'll follow:

3. [Create Swarm cluster comprising Linux and Windows nodes](#create-swarm-cluster-comprising-linux-and-windows-nodes)

4. [Run heterogeneous Linux / Windows application on Swarm cluster](#run-heterogeneous-linux--windows-application-on-swarm-cluster)
4. [Run heterogeneous Linux / Windows application on Swarm cluster](#run-heterogeneous-linux--windows-application-on-swarm-cluster)

# Application Description and Architecture
The Bike Commuter Weather App is intended for bicycle commuters, for whom
wind speed and direction are critical parameters - many weather apps leave this
wind speed and direction are critical parameters - many weather apps leave this
out or de-emphasize it. The architecture looks like this:

* Web UI: ASP.NET 4.6 application hosted in a Docker Windows Container
* Backend Web Service: Python REST web service, wrapping a weather service,
* Backend Web Service: Python REST web service, wrapping a weather service,
hosted in a Docker Linux Container

_**\<\<INSERT Docker-swarm-diagram here\>\>**_
Expand All @@ -45,19 +46,19 @@ Open an Admin command prompt:

## Install Git
<pre>
> choco install git -y
> choco install git -y
</pre>

## Install npm package manager
Use npm to install Azure CLI (the same approach is used with Mac OS X
Use npm to install Azure CLI (the same approach is used with Mac OS X
and Linux, if you should choose to use one of those as your client platform):

<pre>
> choco install nodejs.install -y
</pre>

## Install openssl and other Unix utilities
Since openssl and other Unix utilities are referenced by Azure CLI,
## Install openssl and other Unix utilities
Since openssl and other Unix utilities are referenced by Azure CLI,
install Cygwin and its package manager cyg-get:

<pre>
Expand All @@ -67,7 +68,7 @@ install Cygwin and its package manager cyg-get:
</pre>

## Install Azure CLI
_**Open "Cygwin64 Terminal" from the desktop icon and use it for all
_**Open "Cygwin64 Terminal" from the desktop icon and use it for all
remaining commands.**_

<pre>
Expand All @@ -82,25 +83,25 @@ Navigate to [Docker Toolbox](https://www.docker.com/products/docker-toolbox)
to download and run the installer.

# Provision Swarm cluster VM hosts, build and push Images to Registry
If you don't have an Azure account, you can get a [30-day trial](https://azure.microsoft.com/en-us/free/) with a $200
If you don't have an Azure account, you can get a [30-day trial](https://azure.microsoft.com/en-us/free/) with a $200
credit - this requires a credit card to sign-up, but the card will
not be charged for the first month's usage.

## Login using Azure subscription credentials
_Substitute your Azure Account Id for **yourAzureAccountId** below:_

<pre>
$ azure login <b>yourAzureAccountId</b>
</pre>

You'll see a code in the command line window - as the on-screen instructions
say, go to [aka.ms/devicelogin](https://aka.ms/devicelogin)
say, go to [aka.ms/devicelogin](https://aka.ms/devicelogin)
and enter the code.

_Optional: If you have more than one Azure subscription associated with the
_Optional: If you have more than one Azure subscription associated with the
account, specify the subscription to use in subsequent commands as follows,
substituting the subscription id (from the Azure portal) for
**yourDefaultAzureSubscriptionId** below:_
substituting the subscription id (from the Azure portal) for
**yourDefaultAzureSubscriptionId** below:_

<pre>
$ azure account set <b>yourDefaultAzureSubscriptionId</b>
Expand All @@ -112,31 +113,31 @@ Change mode to ARM (Azure Resource Manager):
$ azure config mode arm
</pre>

Create a resource group which will contain all the resources for
Create a resource group which will contain all the resources for
the Swarm cluster:

<pre>
$ azure group create -n "cliEastUsSwarmRG" -l "East US"
</pre>

## Provision VM host for Windows Swarm node using Azure ARM template
You'll provision the Windows Swarm node first using an ARM template,
since Windows is not yet fully supported by the Azure CLI "azure vm docker
create" command. The "cli-win-node_subnet" created by this provisioning step
You'll provision the Windows Swarm node first using an ARM template,
since Windows is not yet fully supported by the Azure CLI "azure vm docker
create" command. The "cli-win-node_subnet" created by this provisioning step
is subsequently used by the Linux VM provisioning steps.

_You'll need to substitute a unique node name for the "dnsNameForPublicIP"
_You'll need to substitute a unique node name for the "dnsNameForPublicIP"
parameter before running the following command in place of
**uniqueWindowsNodeName**, such as "myname-win-node" - this step can take up
**uniqueWindowsNodeName**, such as "myname-win-node" - this step can take up
to 20 minutes to complete:_

<pre>
$ azure group deployment create cliEastUsSwarmRG cli-win-node --template-uri https://raw.githubusercontent.com/brogersyh/Dockerfiles-for-windows/master/dotnet-aspnet46-webapp/azuredeploy.json -p '{"adminUsername": {"value": "Azure123"}, "adminPassword": {"value": "Azure!23"}, "dnsNameForPublicIP": {"value": "<b>uniqueWindowsNodeName</b>"}, "VMName": {"value": "cli-win-node"},"location": {"value": "East US"}}'
</pre>

## Provision VM host for Swarm Manager and Registry using Azure docker create
Below you will create the Swarm manager VM with its own NIC, Public IP Address
and a new storage account, sharing the Windows VM host subnet created earlier.
Below you will create the Swarm manager VM with its own NIC, Public IP Address
and a new storage account, sharing the Windows VM host subnet created earlier.
Ubuntu is used in this tutorial for the Linux VMs.

_This step can take up to 15 minutes to complete._
Expand All @@ -145,19 +146,19 @@ _This step can take up to 15 minutes to complete._
$ azure vm docker create --resource-group cliEastUsSwarmRG --name cli-swarm-master -l "East US" --os-type linux --nic-name clitestnic --public-ip-name clitestpip --vnet-name cli-win-node_vnet --vnet-subnet-name cli-win-node_subnet --storage-account-name cliswarmstorageacct --vnet-address-prefix 10.0.0/16 --vnet-subnet-address-prefix 10.0.0/24 --image-urn canonical:UbuntuServer:14.04.4-LTS:14.04.201602220 --admin-username Azure123 --admin-password 'Azure!23'
</pre>

_When prompted for "public IP domain name", provide a **uniqueManagerName** that
will be unique in the eastus.cloudapp.azure.com DNS namespace, such as
_When prompted for "public IP domain name", provide a **uniqueManagerName** that
will be unique in the eastus.cloudapp.azure.com DNS namespace, such as
"myname-manager"_

This will be DNS-accessible as **uniqueManagerName**.eastus.cloudapp.azure.com

### Configure Manager VM host Docker Engine startup options
For the purposes of this tutorial, you will disable TLS for the entire swarm,
For the purposes of this tutorial, you will disable TLS for the entire swarm,
since TLS is not working with the Windows Docker Engine as of TP4.

_For **uniqueManagerName** below, substitute the name you supplied above,
such as "myname-manager"_:

<pre>
$ ssh <b>uniqueManagerName</b>.eastus.cloudapp.azure.com -l Azure123
</pre>
Expand Down Expand Up @@ -186,7 +187,7 @@ In order to utilize the Label-based deployment described in
(#run-heterogeneous-linux--windows-application-on-swarm-cluster)
below, you'll need a Docker registry.

Since Windows, as of TP4, does not support Docker Hub, you'll set up a
Since Windows, as of TP4, does not support Docker Hub, you'll set up a
local Docker Registry, sharing the same host VM as the Swarm Manager.

<pre>
Expand All @@ -203,8 +204,8 @@ _This step can take up to 15 minutes to complete._
$ azure vm docker create --resource-group cliEastUsSwarmRG --name cli-linux-node -l "East US" --os-type linux --nic-name clitestnic-linux-node --public-ip-name clitestpip-linux-node --vnet-name cli-win-node_vnet --vnet-subnet-name cli-win-node_subnet --storage-account-name cliswarmstorageacct --vnet-address-prefix 10.0.0/16 --vnet-subnet-address-prefix 10.0.0/24 --image-urn canonical:UbuntuServer:14.04.4-LTS:14.04.201602220 --admin-username Azure123 --admin-password 'Azure!23'
</pre>

_When prompted for "public IP domain name", provide a **uniqueLinuxNodeName**
that will be unique in the eastus.cloudapp.net DNS namespace, such as
_When prompted for "public IP domain name", provide a **uniqueLinuxNodeName**
that will be unique in the eastus.cloudapp.net DNS namespace, such as
"myname-linux-node"_

### Configure Linux node VM Docker Engine startup options
Expand Down Expand Up @@ -321,7 +322,7 @@ PS > docker push <b>uniqueManagerName</b>.eastus.cloudapp.azure.com:5000/rushhou
</pre>

# Create Swarm cluster comprising Linux and Windows nodes
You'll use the docker client on your workstation to create the Swarm cluster.
You'll use the docker client on your workstation to create the Swarm cluster.
The sequence of steps is:

1. Create Swarm cluster id on the Manager host
Expand All @@ -341,21 +342,21 @@ $ docker -H tcp://<b>uniqueManagerName</b>.eastus.cloudapp.azure.com:2376 run --
</pre>

_The cluster id is the guid code which is output at the end of the above
command - save this as you will need it later on, referred to as
command - save this as you will need it later on, referred to as
**myClusterId**._

## Join Linux node to Swarm cluster
For **uniqueLinuxNodeName** below, substitute the unique Linux host name you recorded
above, for **linuxNodeAdvertiseIP** below, the IP address, and for
For **uniqueLinuxNodeName** below, substitute the unique Linux host name you recorded
above, for **linuxNodeAdvertiseIP** below, the IP address, and for
**myClusterId**, the cluster id:_

<pre>
$ docker -H tcp://<b>uniqueLinuxNodeName</b>.eastus.cloudapp.azure.com:2375 run -d swarm join --advertise=<b>linuxNodeAdvertiseIP</b>:2375 token://<b>myClusterId</b>
</pre>

## Join Windows node to Swarm cluster
_For **uniqueWindowsNodeName** below, substitute the unique Windows host name you recorded
above, for **windowsNodeAdvertiseIP**, the IP address, and for **myClusterId**,
_For **uniqueWindowsNodeName** below, substitute the unique Windows host name you recorded
above, for **windowsNodeAdvertiseIP**, the IP address, and for **myClusterId**,
the cluster id:_

<pre>
Expand All @@ -369,7 +370,7 @@ you recorded above, and for **myClusterId**, the cluster id:_
$ docker -H tcp://<b>uniqueManagerName</b>.eastus.cloudapp.azure.com:2376 run -d -p 2375:2375 swarm manage token://<b>myClusterId</b>
</pre>

Set SWARM_HOST environment variable on the workstation so that subsequent
Set SWARM_HOST environment variable on the workstation so that subsequent
docker client commands default to using the Swarm Manager.

_For **uniqueManagerName** below, substitute the name you supplied above,
Expand All @@ -378,7 +379,7 @@ such as "myname-manager":_
<pre>
$ export DOCKER_HOST=<b>uniqueManagerName</b>.eastus.cloudapp.azure.com:2375
</pre>

List the nodes - you should see something like the excerpt below, showing
both Linux and Windows nodes up. You'll sometimes need to wait up to 1
minute for the service discovery process to complete, and both nodes to appear:
Expand Down Expand Up @@ -431,7 +432,7 @@ api key (note the demo application will run without this key, displaying an erro
message that the key is required):

<pre>
$ docker run --name rushhourweatherappservice -d -p 5000:5000 -e constraint:ostypelabel==linuxcompat -e WUNDERGROUND_API_KEY=<b>yourWundergroundApiKey</b> <b>uniqueManagerName</b>.eastus.cloudapp.azure.com:5000/rushhourweatherappservice
$ docker run --name rushhourweatherappservice -d -p 5000:5000 -e constraint:ostypelabel==linuxcompat -e WUNDERGROUND_API_KEY=<b>yourWundergroundApiKey</b> <b>uniqueManagerName</b>.eastus.cloudapp.azure.com:5000/rushhourweatherappservice
</pre>

## Run App Web UI in a Windows Container on the Swarm cluster
Expand Down Expand Up @@ -494,7 +495,7 @@ Name: d73f6f2cf088

## Try out the running application on the Swarm cluster

_For **uniqueWindowsNodeName** and **uniqueLinuxNodeName** below, substitute the
_For **uniqueWindowsNodeName** and **uniqueLinuxNodeName** below, substitute the
names you supplied above, such as "myname-win-node" and "myname-linux-node"._

Try out the Web UI application from a web browser - navigate to:
Expand All @@ -503,7 +504,7 @@ Try out the Web UI application from a web browser - navigate to:
http://<b>uniqueWindowsNodeName</b>.eastus.cloudapp.azure.com/RushHourWeatherApp
</pre>

The Web UI Windows application consumes the Linux service - you can directly examine
The Web UI Windows application consumes the Linux service - you can directly examine
the Linux service by navigating to:

<pre>
Expand All @@ -512,7 +513,7 @@ http://<b>uniqueLinuxNodeName</b>.eastus.cloudapp.azure.com:5000/today/amrush

# Credits
* [Stefan Scherer: How to run a Windows Docker Engine in Azure]
(https://stefanscherer.github.io/how-to-run-windows-docker-engine-in-azure/) - defines an Azure ARM template which improves on the
(https://stefanscherer.github.io/how-to-run-windows-docker-engine-in-azure/) - defines an Azure ARM template which improves on the
[Msft Azure TP4 quickstart-templates](https://github.com/Azure/azure-quickstart-templates), including enabling public TCP listening
* [Stefan Scherer: Build Docker Swarm binary for Windows the "Docker way"]
(https://stefanscherer.github.io/build-docker-swarm-for-windows-the-docker-way/)- dockerized Swarm Image for Windows
Expand Down
6 changes: 6 additions & 0 deletions windows/windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Windows and .NET Tutorials

We have two Windows and .NET tutorials

* [Run .NET Core in a Linux Container](dotnet-core/index.md)
* [Running a Heterogeneous Azure-hosted Swarm Cluster](dotnet-linux-het/swarm.md)

0 comments on commit 67debcf

Please sign in to comment.