Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit f9b8a44

Browse files
committed
Update to Windows Server 2019
Signed-off-by: Elton Stoneman <[email protected]>
1 parent e952389 commit f9b8a44

File tree

8 files changed

+88
-223
lines changed

8 files changed

+88
-223
lines changed

windows/windows-containers/MultiContainerApp.md

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
This tutorial walks you through building and running the sample Album Viewer application with Windows containers. The [Album Viewer](https://github.com/RickStrahl/AlbumViewerVNext) app is an ASP.NET Core application, maintained by Microsoft MVP [Rick Strahl](https://weblog.west-wind.com). There is a fork at [dockersamples/dotnet-album-viewer](https://github.com/dockersamples/dotnet-album-viewer "link to forked version of Album Viewer") which uses Docker Windows containers.
44

5-
> Docker isn't just for new apps built with .NET Core. You can run full .NET Framework apps in Docker Windows containers, with production support in [Docker EE](https://www.docker.com/enterprise-edition). Check out the labs for [Modernizing .NET apps with Docker](https://github.com/docker/labs/tree/master/windows/modernize-traditional-apps).
5+
> Docker isn't just for new apps built with .NET Core. You can run full .NET Framework apps in Docker Windows containers, with production support in [Docker Enterprise](https://www.docker.com/enterprise-edition). Check out the labs for [Modernizing .NET apps with Docker](https://github.com/docker/labs/tree/master/windows/modernize-traditional-apps).
66
77
## Using Docker Compose on Windows
88

99
[Docker Compose](https://docs.docker.com/compose/) is a great way develop distributed applications, where all the components run in their own containers. In this lab you'll use Docker Compose to run SQL Server in a container, as the data store for an ASP.NET Core web application running in another container.
1010

11-
Docker Compose is installed with [Docker for Windows](https://www.docker.com/docker-windows). If you've installed Docker as a Windows Service instead, you can download the compose command line using PowerShell:
11+
Docker Compose is installed with [Docker Desktop on Windows 10](https://www.docker.com/docker-windows). If you've installed the Docker Engine as a Windows Service instead, you can download the compose command line using PowerShell:
1212

1313
```
14-
Invoke-WebRequest https://github.com/docker/compose/releases/download/1.16.0/docker-compose-Windows-x86_64.exe -UseBasicParsing -OutFile $env:ProgramFiles\docker\docker-compose.exe
14+
Invoke-WebRequest https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Windows-x86_64.exe -UseBasicParsing -OutFile $env:ProgramFiles\docker\docker-compose.exe
1515
```
1616

1717
To run the sample application in multiple Docker Windows containers, start by cloning the GithUb [dockersamples/dotnet-album-viewer](https://github.com/dockersamples/dotnet-album-viewer/) repository:
@@ -27,41 +27,32 @@ cd dotnet-album-viewer
2727
docker-compose build
2828
```
2929

30-
You'll see a lot of output here. Docker will pull the .NET Core images if you don't already have them, then it will run `dotnet restore` and `dotnet build` inside a container. You will see the usual NuGet and MSBuild output, even if you don't have the SDK installed.
30+
You'll see a lot of output here. Docker will pull the .NET Core images if you don't already have them, then it will run `dotnet restore` and `dotnet build` inside a container. You will see the usual NuGet and MSBuild output - you don't need to have the .NET Core SDK installed, because it is part of the Docker image.
3131

3232
When the build completes, run the app with:
3333

3434
```
3535
docker-compose up -d
3636
```
3737

38-
Docker starts a database container using Microsoft's [SQL Server Express Windows image](https://store.docker.com/images/mssql-server-windows-express), and when the database is running it starts the application container. The database and application containers are in the same Docker network, so they can reach each other.
38+
Docker starts a database container using [TiDB](https://github.com/pingcap/tidb), which is a modern distributed database system compatible with MySQL. When the database is running it starts the application container. The database and application containers are in the same Docker network, so they can reach each other.
3939

40-
The container for the web application maps to port 80 on the host, so from a different machine you can browse to your host address and see the site:
40+
The container for the web application publishes port 80 on the host, so you can browse to your http://localhost and see the site:
4141

4242
![ASP.NET Core Album Viewer app running in a Docker Windows container](images/dotnet-album-viewer.png)
4343

44-
If you're working on the host, you need to browse to the container's IP address. You can find it with `docker container inspect`:
45-
46-
```
47-
docker container inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" dotnetalbumviewer_app_1
48-
172.21.124.54
49-
```
5044

5145
### Organizing Distributed Solutions with Docker Compose
5246

53-
Take a closer look at the [docker-compose.yml](https://github.com/dockersamples/dotnet-album-viewer/blob/master/docker-compose.yml) file. There are two [services](https://docs.docker.com/compose/compose-file/#service-configuration-reference) defined, which are the different components of the app that will run in Docker containers. The first is the SQL Server database:
47+
Take a closer look at the [docker-compose.yml](https://github.com/dockersamples/dotnet-album-viewer/blob/master/docker-compose.yml) file. There are two [services](https://docs.docker.com/compose/compose-file/#service-configuration-reference) defined, which are the different components of the app that will run in Docker containers. The first is the MySQL-compatible database:
5448

5549
```
5650
db:
57-
image: microsoft/mssql-server-windows-express
58-
environment:
59-
sa_password: "DockerCon!!!"
60-
ACCEPT_EULA: "Y"
51+
image: dockersamples/tidb:nanoserver-1809
52+
ports:
53+
- "3306:4000"
6154
```
6255

63-
This uses Microsoft SQL Server Express, which runs as a Docker Windows container. Express edition has a production licence, so you can use it for live applications. The environment settings configure the database, setting the password for the `sa` user account, and accepting the licence agreement.
64-
6556
The second service is the ASP.NET Core web application, which uses the custom image you built at the start of the lab:
6657

6758
```
@@ -70,42 +61,40 @@ The second service is the ASP.NET Core web application, which uses the custom im
7061
build:
7162
context: .
7263
dockerfile: docker/app/Dockerfile
64+
ports:
65+
- "80:80"
7366
environment:
74-
- "Data:useSqLite=false"
75-
- "Data:SqlServerConnectionString=Server=db;Database=AlbumViewer;User Id=sa;Password=DockerCon!!!;MultipleActiveResultSets=true;App=AlbumViewer"
67+
- "Data:Provider=MySQL"
68+
- "Data:ConnectionString=Server=db;Port=4000;Database=AlbumViewer;User=root;SslMode=None"
7669
depends_on:
7770
- db
78-
ports:
79-
- "80:80"
8071
```
8172

82-
The [build](https://docs.docker.com/compose/compose-file/#build) details capture the path to the Dockerfile. The environment variables are used to configure the app - they override the settings in [appsettings.json](https://github.com/dockersamples/dotnet-album-viewer/blob/master/src/AlbumViewerNetCore/appsettings.json). This configuration uses SQL Server rather than the default SQLite database, and sets the connection string to use the SQL Server container.
73+
The [build](https://docs.docker.com/compose/compose-file/#build) details capture the path to the Dockerfile. The environment variables are used to configure the app - they override the settings in [appsettings.json](https://github.com/dockersamples/dotnet-album-viewer/blob/master/src/AlbumViewerNetCore/appsettings.json). This configuration uses MySQL rather than the default SQLite database, and sets the connection string to use the TiDB database container.
8374

84-
> In the database connection string, the server name is `db` - which is the name of the service for the SQL container. Docker has service discovery built-in, so when the app tries to connect using the server name `db`, Docker will direct it to the database container.
75+
> The database container has a built-in user called `root` with no password, and this is the account used by the web application in the connection string.
8576
8677
The app definition also captures the [dependency](https://docs.docker.com/compose/compose-file/#depends_on) on the database server, and publishes port 80 so any traffic coming into the host gets directed by Docker into the container.
8778

88-
8979
## Packaging ASP.NET Core apps in Docker
9080

91-
How can you compile and run this app without .NET Core installed? Docker compiles and runs the app using containers. The tasks are in the [Dockerfile](https://github.com/dockersamples/dotnet-album-viewer/blob/master/docker/app/Dockerfile), which captures all the app dependencies so the only pre-requisite you need is Docker. The first stage in the Dockerfile publishes the app:
81+
How can you compile and run this app without .NET Core installed? Docker compiles and runs the app using containers. The tasks are in the [Dockerfile](https://github.com/dockersamples/dotnet-album-viewer/blob/master/docker/app/Dockerfile), which captures the app dependencies so the only pre-requisite you need is Docker. The first stage in the Dockerfile publishes the app:
9282

9383
```
94-
FROM microsoft/dotnet:2.0.0-sdk-nanoserver AS builder
95-
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
84+
FROM microsoft/dotnet:2.1-sdk-nanoserver-1809 AS builder
9685
9786
WORKDIR /album-viewer
9887
COPY AlbumViewerNetCore.sln .
9988
COPY src/AlbumViewerNetCore/AlbumViewerNetCore.csproj src/AlbumViewerNetCore/AlbumViewerNetCore.csproj
10089
COPY src/AlbumViewerBusiness/AlbumViewerBusiness.csproj src/AlbumViewerBusiness/AlbumViewerBusiness.csproj
10190
COPY src/Westwind.Utilities/Westwind.Utilities.csproj src/Westwind.Utilities/Westwind.Utilities.csproj
102-
RUN dotnet restore
91+
RUN dotnet restore src/AlbumViewerNetCore/AlbumViewerNetCore.csproj
10392
10493
COPY src src
10594
RUN dotnet publish .\src\AlbumViewerNetCore\AlbumViewerNetCore.csproj
10695
```
10796

108-
This uses Microsoft's [.NET Core Docker image](https://store.docker.com/images/dotnet) as the base in the `FROM` instruction. It uses a specific version of the image, with the .NET Core 2.0.0 SDK installed, running on Microsoft Nano Server. Then the `COPY` instructions copy the project files and solution files into the image, and the `RUN` instruction executes `dotnet restore` to restore packages.
97+
This uses Microsoft's [.NET Core Docker image](https://hub.docker.com/r/microsoft/dotnet) as the base in the `FROM` instruction. It uses a specific version of the image, with the .NET Core 2.1 SDK installed, running on the 1809 release of Microsoft Nano Server. Then the `COPY` instructions copy the project files and solution files into the image, and the `RUN` instruction executes `dotnet restore` to restore packages.
10998

11099
Docker caches parts of the image as it build them, and this Dockerfile separates out the restore part to take advantage of that. Unless the solution or project files change, Docker will re-use the image layer with the dependencies already restored, saving time on the `dotnet restore` operation.
111100

@@ -115,18 +104,16 @@ The final stage in the Dockerfile packages the published application:
115104

116105
```
117106
# app image
118-
FROM microsoft/aspnetcore:2.0.0-nanoserver
119-
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
107+
FROM microsoft/dotnet:2.1-aspnetcore-runtime-nanoserver-1809
120108
121109
WORKDIR /album-viewer
122110
COPY --from=builder /album-viewer/src/AlbumViewerNetCore/bin/Debug/netcoreapp2.0/publish/ .
123111
CMD ["dotnet", "AlbumViewerNetCore.dll"]
124112
```
125113

126-
This uses a different base image, which is optimized for running [ASP.NET Core](https://store.docker.com/community/images/microsoft/aspnetcore) apps. It has the .NET Core runtime, but not the SDK, and the ASP.NET core packages are already installed. The `COPY` instruction copies the published .NET Core app from the previous stage in the Dockerfile (called `builder`), and the `CMD` instruction tells Docker how to start the app.
127-
128-
The Dockerfile syntax is simple. You only need to learn a handful of instructions to build production-grade Docker images. Inside the Dockerfile, you can use PowerShell to deploy MSIs, update Windows Registry settings, set file permissions and do anything else you need.
114+
This uses a different variant of the `dotnet` base image, which is optimized for running ASP.NET Core apps. It has the .NET Core runtime, but not the SDK, and the ASP.NET core packages are already installed. The `COPY` instruction copies the published .NET Core app from the previous stage in the Dockerfile (called `builder`), and the `CMD` instruction tells Docker how to start the app.
129115

116+
The Dockerfile syntax is simple. You only need to learn a handful of instructions to build production-grade Docker images. Inside the Dockerfile you can use PowerShell to deploy MSIs, update Windows Registry settings, set file permissions and do anything else you need.
130117

131118
## Next Steps
132119

windows/windows-containers/README.md

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,58 @@
1-
## Getting Started with Windows Containers
1+
# Getting Started with Windows Containers
22

3-
In September 2016, Microsoft announced the general availability of Windows Server 2016, and with it, Docker engine running containers natively on Windows. This tutorial describes how to get setup to run Docker Windows Containers on Windows 10 or using a Windows Server 2016 VM.
3+
Docker containers run natively in Windows Server 2016, Windows Server 2019 and Windows 10. These labs are based on the latest releases of Windows and Docker which provide the best experience for containerized Windows applications.
44

5-
If you are developing locally, you must be running Windows 10 pro or Windows 2016 in a virtual machine to be able to use this tutorial.
5+
The minimum requirements are:
66

7-
If you're using a cloud VM, you must use Windows 2016 VM.
7+
* Windows 10 Professional or Enterprise, with Windows update 1809 *or*
8+
* Windows Server 2019
89

10+
## Step 1 - Setup
911

10-
This tutorial consists of three parts:
12+
You can run Windows containers on Windows 10, Windows Server 2016 and Windows Server 2019:
1113

12-
1. [Setup](Setup.md "Setup"): Making sure your development environment is properly set-up to work with Windows Containers.
13-
2. [Getting Started with Windows Containers](WindowsContainers.md "Getting Started with Windows Containers"): The basics of Windows Containers.
14-
3. [Multi-Container Applications](MultiContainerApp.md "Multi-Container Applications"): Using [Docker Compose](https://docker.github.io/compose/ "Docker Compose") to launch a website based on Microsoft SQL Server.
14+
+ [Install Docker Desktop on Windows 10](https://hub.docker.com/editions/community/docker-ce-desktop-windows "Windows 10 Setup")
15+
+ [Install Docker Enterprise Engine on Windows Server](https://hub.docker.com/editions/enterprise/docker-ee-server-windows "Setup on Windows Server")
16+
17+
> Most public cloud providers also have a VM image with Docker already installed. You can use Microsoft's **Windows Server 2019 Datacenter with Containers** VM image on Azure, and Amazon's **Microsoft Windows Server 2019 Base with Containers** AMI on AWS.
18+
19+
## Verification
20+
21+
Run `docker version` to check the basic details of your deployment. You should see "Windows" listed as the operating system for the Docker client and the Docker Engine:
22+
23+
```
24+
PS>docker version
25+
Client: Docker Engine - Community
26+
Version: 18.09.1
27+
API version: 1.39
28+
Go version: go1.10.6
29+
Git commit: 4c52b90
30+
Built: Wed Jan 9 19:34:26 2019
31+
OS/Arch: windows/amd64
32+
Experimental: false
33+
34+
Server: Docker Engine - Community
35+
Engine:
36+
Version: 18.09.1
37+
API version: 1.39 (minimum version 1.24)
38+
Go version: go1.10.6
39+
Git commit: 4c52b90
40+
Built: Wed Jan 9 19:50:10 2019
41+
OS/Arch: windows/amd64
42+
Experimental: true
43+
```
44+
45+
> The `OS/Arch` field tells you the operating system and CPU architecture you're using. Docker is cross-platform, so you can manage Windows Docker servers from a Linux client and vice-versa, using the same `docker` commands.
46+
47+
## Windows Versions
48+
49+
The latest release of Windows to support Docker containers is Windows Server 2019, and Windows 10 with the 1809 update. There are many enhancements from the original Windows containers release in Server 2016.
50+
51+
> [Read about the new container features with Docker on Windows Server 2019](https://blog.docker.com/2019/01/announcing-support-for-windows-server-2019-within-docker-enterprise/)
52+
53+
Windows containers need to match the version of the OS where the container is running with the version of the OS inside the container. Container images flagged as `ltsc2019` or `1809` work with the latest Windows versions.
54+
55+
56+
## Next Steps
57+
58+
Continue to Step 2: [Getting Started with Windows Containers](WindowsContainers.md "Getting Started with Windows Containers")

windows/windows-containers/Setup-AWS.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

windows/windows-containers/Setup-Azure.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)