Build and run your first Docker Windows Server container

Today, Microsoft announced the general availability of Windows Server 2016, and with it, Docker engine running containers natively on Windows. This blog post describes how to get setup to run Docker Windows Containers on Windows 10 or using a Windows Server 2016 VM. Check out the companion blog posts on the technical improvements that have made Docker containers on Windows possible and the post announcing the Docker Inc. and Microsoft partnership.

Before getting started, It’s important to understand that Windows Containers run Windows executables compiled for the Windows Server kernel and userland (either windowsservercore or nanoserver). To build and run Windows containers, a Windows system with container support is required.

Windows 10 with Anniversary Update

For developers, Windows 10 is a great place to run Docker Windows containers and containerization support was added to the the Windows 10 kernel with the Anniversary Update (note that container images can only be based on Windows Server Core and Nanoserver, not Windows 10). All that’s missing is the Windows-native Docker Engine and some image base layers.

The simplest way to get a Windows Docker Engine is by installing the Docker for Windows public beta (direct download link). Docker for Windows used to only setup a Linux-based Docker development environment (slightly confusing, we know), but the public beta version now sets up both Linux and Windows Docker development environments, and we’re working on improving Windows container support and Linux/Windows container interoperability.

With the public beta installed, the Docker for Windows tray icon has an option to switch between Linux and Windows container development. For details on this new feature, check out Stefan Scherers blog post.

Switch to Windows containers and skip the next section.

switching to windows containers

Windows Server 2016

Windows Server 2016 is the where Docker Windows containers should be deployed for production. For developers planning to do lots of Docker Windows container development, it may also be worth setting up a Windows Server 2016 dev system (in a VM, for example), at least until Windows 10 and Docker for Windows support for Windows containers matures.

For Microsoft Ignite 2016 conference attendees, USB flash drives with Windows Server 2016 preloaded are available at the expo. Not at ignite? Download a free evaluation version and install it on bare metal or in a VM running on Hyper-V, VirtualBox or similar. Running a VM with Windows Server 2016 is also a great way to do Docker Windows container development on macOS and older Windows versions.

Once Windows Server 2016 is running, log in, run Windows Update to ensure you have all the latest updates and install the Windows-native Docker Engine directly (that is, not using “Docker for Windows”). Run the following in an Administrative PowerShell prompt:

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name DockerMsftProvider -Force
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
Restart-Computer -Force

Docker Engine is now running as a Windows service, listening on the default Docker named pipe. For development VMs running (for example) in a Hyper-V VM on Windows 10, it might be advantageous to make the Docker Engine running in the Windows Server 2016 VM available to the Windows 10 host:

# Open firewall port 2375
netsh advfirewall firewall add rule name="docker engine" dir=in action=allow protocol=TCP localport=2375

# Configure Docker daemon to listen on both pipe and TCP (replaces docker --register-service invocation above)
Stop-Service docker
dockerd --unregister-service
dockerd -H npipe:// -H 0.0.0.0:2375 --register-service
Start-Service docker

The Windows Server 2016 Docker engine can now be used from the VM host by setting DOCKER_HOST:

$env:DOCKER_HOST = "<ip-address-of-vm>:2375"

See the Microsoft documentation for more comprehensive instructions.

Running Windows containers

First, make sure the Docker installation is working:

> docker version
Client:
Version:      1.12.1
API version:  1.24
Go version:   go1.6.3
Git commit:   23cf638
Built:        Thu Aug 18 17:32:24 2016
OS/Arch:      windows/amd64
Experimental: true

Server:
Version:      1.12.2-cs2-ws-beta
API version:  1.25
Go version:   go1.7.1
Git commit:   62d9ff9
Built:        Fri Sep 23 20:50:29 2016
OS/Arch:      windows/amd64

Next, pull a base image that’s compatible with the evaluation build, re-tag it and to a test-run:

docker pull microsoft/windowsservercore
docker run microsoft/windowsservercore hostname
69c7de26ea48

Building and pushing Windows container images

Pushing images to Docker Cloud requires a free Docker ID. Storing images on Docker Cloud is a great way to save build artifacts for later user, to share base images with co-workers or to create build-pipelines that move apps from development to production with Docker.

Docker images are typically built with docker build from a Dockerfile recipe, but for this example, we’re going to just create an image on the fly in PowerShell.

"FROM microsoft/windowsservercore `n CMD echo Hello World!" | docker build -t <docker-id>/windows-test-image -

Test the image:

docker run <docker-id>/windows-test-image
Hello World!

Login with docker login and then push the image:

docker push <docker-id>/windows-test-image

Images stored on Docker Cloud available in the web interface and public images can be pulled by other Docker users.

Using docker-compose on Windows

Docker Compose is a great way develop complex multi-container consisting of databases, queues and web frontends. Compose support for Windows is still a little patchy and only works on Windows Server 2016 at the time of writing (i.e. not on Windows 10).

To develop with Docker Compose on a Windows Server 2016 system, install compose too (this is not required on Windows 10 with Docker for Windows installed):

Invoke-WebRequest https://dl.bintray.com/docker-compose/master/docker-compose-Windows-x86_64.exe -UseBasicParsing -OutFile $env:ProgramFiles\docker\docker-compose.exe

To try out Compose on Windows, clone a variant of the ASP.NET Core MVC MusicStore app, backed by a SQL Server Express 2016 database. A correctly tagged microsoft/windowsservercore image is required before starting.

git clone https://github.com/friism/Musicstore
...
cd Musicstore
docker-compose -f .\docker-compose.windows.yml build
...
docker-compose -f .\docker-compose.windows.yml up
...

To access the running app from the host running the containers (for example when running on Windows 10 or if opening browser on Windows Server 2016 system running Docker engine) use the container IP and port 5000. localhost will not work:

docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" musicstore_web_1
172.21.124.54

If using Windows Server 2016 and accessing from outside the VM or host, simply use the VM or host IP and port 5000.

Summary

This post described how to get setup to build and run native Docker Windows containers on both Windows 10 and using the recently published Windows Server 2016 evaluation release. To see more example Windows Dockerfiles, check out the Golang, MongoDB and Python Docker Library images.
Please share any Windows Dockerfiles or Docker Compose examples your build with @docker on Twitter using the tag #windows. And don’t hesitate to reach on the Docker Forums if you have questions.

More Resources:

, , , ,

Build and run your first Docker Windows Server container


74 Responses to “Build and run your first Docker Windows Server container”

  1. JGAITPro

    Hello, when starting the service displays the following error docker:

    Start-Service : No pudo iniciarse el servicio 'Docker Engine (docker)'.
    En línea: 1 Carácter: 1
    + Start-Service docker
    + ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
    ServiceCommandException
    + FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.StartServiceCommand

    Thanks!

    Reply
    • Michael Friis

      This suggests that the `dockerd –register-service` step didn't succeed.

      Reply
      • Kevin Jenkins

        im having the same issue however it seems that the service did succeed

        Reply
      • putri

        I have the same problem, but when I try 'dockerd –register-service', the output says:

        level=fatal msg="The specified service already exists."

        What should I do?

        Reply
  2. Ravi

    Hello Michael, successfully build but getting error while compose. Requesting, Please do the need.
    PS C:\Musicstore> docker-compose -f .\src\MusicStore\docker-compose.yml up

    docker-compose : The term 'docker-compose' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
    name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + docker-compose -f .\src\MusicStore\docker-compose.yml up
    + ~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (docker-compose:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    Reply
    • Michael Friis

      You have to dowload the compose executable, rename it to `docker-compose.exe` and place it somewhere in your path (for example in `$env:ProgramFiles\docker` with `docker.exe` and `dockerd.exe`.)

      Reply
  3. Robert Colbert

    I'll be filing a bug on GitHub but wanted to share this. If you normally compress your system drive, the following folders must be uncompressed for Hyper-V containers to run:
    C:\ProgramData\Microsoft\Windows\Hyper-V\Container Images Store
    C:\ProgramData\Microsoft\Windows\Hyper-V\Conttainer Utility VM
    C:\ProgramData\Docker\windowsfilter

    If they are compressed, Docker will fail to launch the container.

    Reply
  4. Jay

    I installed the beta but there is no menu to switch to Windows container. I'm on Windows 10 Anniversary Update. What could be the problem?

    Reply
  5. Sasi

    Getting the below error while running docker-compose up. Any idea please? (i am using Windows Server 2016 TP5 BTW)

    PS C:\> docker-compose up -d
    Recreating default_web_1

    ERROR: for web Windows does not support disconnecting a running container from a network
    ERROR: Encountered errors while bringing up the project.

    Reply
  6. George

    We have pretty good Linux docker in docker build pipeline for our NodeJS micro services services. We're looking to build a UWP app and wondering if there's a similar pattern we can implement. We made some initial attempts using nano and core but there seemed to be missing pieces to get a UWP build working.

    Reply
  7. Johnny

    I installed docker version 1.13.0-dev directly following the instructions here: https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quick_start_windows_10

    Is there any way to switch between Linux and Windows? It looks like I'm missing DockerCli.

    Reply
  8. Cormac

    I successfully installed docker for windows beta on latest windows 10 anniversary (10.0.14393) , and ran successfully the hello world app (in linux container mode) through powershell. Then i changed to windows container mode. I could not successfully pull any windows images. Some of the images dont mention windows 10 anniv . Does this mean they will not run on in it? Or could i be missing some other packages?

    docker pull microsoft/windowsservercore – failed with Docker : local error: tls: record overflow

    docker pull microsoft/mssql-server – kept freezing with the message: Please login prior to pull:

    docker pull microsoft/aspnet – components appear to fail to download with a 'Retrying in xx seconds ' message.

    A second effort got a lot further, but hung at 'download complete' for one of the components.

    PS C:\Windows\system32> docker info
    Containers: 0
    Running: 0
    Paused: 0
    Stopped: 0
    Images: 0
    Server Version: 1.12.2-cs2-ws-beta
    Storage Driver: windowsfilter
    Windows:
    Logging Driver: json-file
    Plugins:
    Volume: local
    Network: nat null overlay
    Swarm: inactive
    Security Options:
    Kernel Version: 10.0 14393 (14393.321.amd64fre.rs1_release_inmarket.161004-2338)
    Operating System: Windows 10 Enterprise
    OSType: windows
    Architecture: x86_64
    CPUs: 16
    Total Memory: 31.91 GiB
    Name: TheOrcWin10E
    ID: KFA6:43UR:QW2A:MGES:E6RO:K5GW:B5YM:ZOSR:JAEC:KM3Q:Y3PG:V6D2
    Docker Root Dir: C:\ProgramData\Docker
    Debug Mode (client): false
    Debug Mode (server): false
    Registry: https://index.docker.io/v1/
    Insecure Registries:
    127.0.0.0/8

    Do we know if these containers will run on win 10 anniv, and is there an alternative method to manually download the containers?

    Reply
    • Cormac

      Addendum to the above!: THe second pull attempt for microsoft/aspnet did seem to complete successfully:

      PS C:\Windows\system32> docker pull microsoft/aspnet
      Using default tag: latest
      latest: Pulling from microsoft/aspnet
      9c7f9c7d9bc2: Pulling fs layer
      de5064718b3f: Pulling fs layer
      3abe74683942: Pulling fs layer
      907e871a8de2: Pulling fs layer
      ba066d7d1bad: Pulling fs layer
      b8c8a13e99c3: Pulling fs layer
      907e871a8de2: Waiting
      ba066d7d1bad: Waiting
      b8c8a13e99c3: Waiting
      3abe74683942: Verifying Checksum
      3abe74683942: Download complete
      907e871a8de2: Verifying Checksum
      907e871a8de2: Download complete
      ba066d7d1bad: Verifying Checksum
      ba066d7d1bad: Download complete
      b8c8a13e99c3: Verifying Checksum
      b8c8a13e99c3: Download complete
      de5064718b3f: Retrying in 5 seconds
      de5064718b3f: Retrying in 4 seconds
      de5064718b3f: Retrying in 3 seconds
      de5064718b3f: Retrying in 2 seconds
      de5064718b3f: Retrying in 1 second
      de5064718b3f: Retrying in 10 seconds
      de5064718b3f: Retrying in 9 seconds
      de5064718b3f: Retrying in 8 seconds
      de5064718b3f: Retrying in 7 seconds
      de5064718b3f: Retrying in 6 seconds
      de5064718b3f: Retrying in 5 seconds
      de5064718b3f: Retrying in 4 seconds
      de5064718b3f: Retrying in 3 seconds
      de5064718b3f: Retrying in 2 seconds
      de5064718b3f: Retrying in 1 second
      de5064718b3f: Verifying Checksum
      de5064718b3f: Download complete
      9c7f9c7d9bc2: Verifying Checksum
      9c7f9c7d9bc2: Download complete
      9c7f9c7d9bc2: Pull complete
      de5064718b3f: Pull complete
      3abe74683942: Pull complete
      907e871a8de2: Pull complete
      ba066d7d1bad: Pull complete
      b8c8a13e99c3: Pull complete
      Digest: sha256:6d5c0e56fb5f3af4204f42674b0e2ef5ed27fec4791542a0b8df0dd187ed9ccb
      Status: Downloaded newer image for microsoft/aspnet:latest

      PS C:\Windows\system32>

      Reply
  9. Erik

    I'm not sure what's going on here, but when I reach the Install-Package step to install docker, I get the message:

    WARNING: Cannot find path
    'C:\Users\ADMINI~1\AppData\Local\Temp\DockerMsftProvider\DockerDefault_DockerSearchIndex.json' because it does not
    exist.
    WARNING: Cannot bind argument to parameter 'downloadURL' because it is an empty string.
    WARNING: The property 'AbsoluteUri' cannot be found on this object. Verify that the property exists.
    WARNING: The property 'RequestMessage' cannot be found on this object. Verify that the property exists.
    Install-Package : No match was found for the specified search criteria and package name 'docker'. Try
    Get-PackageSource to see all available registered package sources.
    At line:1 char:1
    + Install-Package -Name docker -ProviderName DockerMsftProvider -Force

    Any ideas?

    Reply
  10. John Waters

    Running the compose example,

    docker-compose -f .\docker-compose.windows.yml build

    Half way through I get

    "Unable to load the service index for source https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json.&quot;
    The server name or address could not be resolved

    Reply
    • Michael Friis

      Strange, that looks like a generic NuGet error – maybe you had an intermittent internet connection problem or similar. Could you try building again?

      Reply
      • Andy

        I also get the same error:

        log : Restoring packages for C:\MusicStore\samples\MusicStore.Standalone\project.json…
        error: Unable to load the service index for source https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json.
        error: An error occurred while sending the request.
        error: The server name or address could not be resolved
        ERROR: Service 'web' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPrefere
        nce = 'SilentlyContinue'; dotnet restore .\samples\MusicStore.Standalone' returned a non-zero code: 1

        Reply
        • VSankar

          I'm also getting the same error.. I checked my internet and its working fine…I tried several time and I also try by modifying NuGet.config with

          <?xml version="1.0" encoding="utf-8"
          <configuration>
          <packageSources>
          <clear />
          <add key="AspNetVNext" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json&quot; />
          <add key="NuGet.org" value="https://api.nuget.org/v3/index.json&quot; />
          </packageSources>
          </configuration>

          Error Details Follows
          Step 9/15 : RUN dotnet restore –runtime win10-x64 .\samples\MusicStore
          —> Running in 5925d4f82a5a
          Restoring packages for C:\MusicStore\samples\MusicStore\MusicStore.csproj…
          C:\Program Files\dotnet\sdk\1.0.1\NuGet.targets(97,5): error : Unable to load the service index for source https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json. [C:\MusicStore\samples\MusicStore\MusicStore.csproj]
          C:\Program Files\dotnet\sdk\1.0.1\NuGet.targets(97,5): error : An error occurred while sending the request. [C:\MusicStore\samples\MusicStore\MusicStore.csproj]
          C:\Program Files\dotnet\sdk\1.0.1\NuGet.targets(97,5): error : The operation timed out [C:\MusicStore\samples\MusicStore\MusicStore.csproj]
          ERROR: Service 'web' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; dotnet restore –runtime win10-x64 .\samples\MusicStore' returned a non-zero code: 1

          Reply
  11. XA

    Hello Michael,

    docker-compose.yml now supports on windows also ? i have one docker-compose.yml file which was built for linux system base image. can i run the same on windows ?
    moreover i have all the DockerFiles built for linux systems now we need to make it for windows and facing really difficult time here. any tool which can help for that ?

    Reply
  12. bora

    Hi,

    I am using 2016 server with Docker setup as an development machine.

    I am trying to run the app with docker in Visual Studio 2015(with Docker Tools installed), but get the following error?

    Is anyone using 2016 server as a VS2015 dev machine?

    Severity Code Description Project File Line Suppression State
    Error MSB4018 The "PrepareForLaunch" task failed unexpectedly.
    Microsoft.DotNet.Docker.CommandLineClientException: Creating network "webapplication1_default" with the default driver
    HNS failed with error : The parameter is incorrect.
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
    at Microsoft.DotNet.Docker.BuildTasks.PrepareForLaunch.<ExecuteAsync>d__0.MoveNext()
    — End of stack trace from previous location where exception was thrown —
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.DotNet.Docker.BuildTasks.DockerBaseTask.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() C:\Projects\WebApplication1\src\WebApplication1\WebApplication1.xproj C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing\ImportAfter\Microsoft.DotNet.Docker.targets 70

    Reply
    • Collin

      bora, Did you ever solve this? I've had problem after problem on Windows 8, which isn't supported by Docker for Windows!. It was clunky with RC2 but it all worked at least.

      I can only run a docker container with virtualbox if I use the –net=host flag. I wonder if this is related to the this error.

      Reply
  13. Sergey

    I try to install windows service in a docker container.
    I use microsoft/windowsservercore image and install service using powershell command:
    New-Service -Name 'Service-Name' -StartupType Automatic -BinaryPathName 'c:\win-service\Service.exe'. Service was installed but doesn't start.
    I try to start service manualy (docker exec -> start-service) but got error:
    Service 'Service-Name' cannot be started due to the following error: Cannot start service Service-Name on computer '.'.

    Reply
  14. Paul

    Hi Michael,

    I fell at the last hurdle I ran the command

    docker-compose -f .\docker-compose.windows.yml up

    But got the following error when it tried to reset the sa login

    db_1 | VERBOSE: Changing SA login credentials
    web_1 |
    web_1 | Unhandled Exception: System.AggregateException: One or more errors occurred. (Login failed for user 'sa'.) —>
    System.Data.SqlClient.SqlException: Login failed for user 'sa'.
    web_1 | at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionStri
    ng connectionOptions, Object providerInfo, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, Se
    ssionData reconnectSessionData, Boolean applyTransientFaultHandling)
    web_1 | at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPool
    Key poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions use
    rOptions)
    web_1 | at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection o
    wningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
    web_1 | at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions use
    rOptions, DbConnectionInternal oldConnection)
    web_1 | at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOption
    s userOptions, DbConnectionInternal oldConnection)
    web_1 | at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMulti
    pleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInt
    ernal& connection)
    web_1 | at System.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
    web_1 | — End of stack trace from previous location where exception was thrown —
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    web_1 | at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.<OpenAsync>d__31.MoveNext()
    web_1 | — End of stack trace from previous location where exception was thrown —
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    web_1 | at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass13_0.<<ExistsAsy
    nc>b__0>d.MoveNext()
    web_1 | — End of stack trace from previous location where exception was thrown —
    web_1 | at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass13_0.<<ExistsAsy
    nc>b__0>d.MoveNext()
    web_1 | — End of stack trace from previous location where exception was thrown —
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    web_1 | at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<ExecuteAsync>d__6`2.MoveNext()
    web_1 | — End of stack trace from previous location where exception was thrown —
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    web_1 | at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.<EnsureCreatedAsync>d__32.MoveNext()
    web_1 | — End of stack trace from previous location where exception was thrown —
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    web_1 | at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
    web_1 | at MusicStore.Models.SampleData.<InitializeMusicStoreDatabaseAsync>d__3.MoveNext()
    web_1 | — End of inner exception stack trace —
    web_1 | at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    web_1 | at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
    web_1 | at System.Threading.Tasks.Task.Wait()
    web_1 | at MusicStore.Startup.Configure(IApplicationBuilder app)
    web_1 | at MusicStore.Startup.ConfigureProduction(IApplicationBuilder app, ILoggerFactory loggerFactory)
    web_1 | — End of stack trace from previous location where exception was thrown —
    web_1 | at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    web_1 | at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
    web_1 | at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
    web_1 | at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
    web_1 | at MusicStore.Standalone.Program.Main(String[] args)
    db_1 | VERBOSE: Started SQL Server.
    musicstore_web_1 exited with code 1

    No idea what to do here? Any ideas?

    Reply
  15. Mike

    When I try and run the above commands I see:

    PS C:\Windows\system32> Install-Module -Name DockerMsftProvider -Force
    PackageManagement\Install-Package : No match was found for the specified search criteria and module name
    'DockerMsftProvider'. Try Get-PSRepository to see all available registered module repositories.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1661 char:21
    + … $null = PackageManagement\Install-Package @PSBoundParameters
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Microsoft.Power….InstallPackage:InstallPackage) [Install-Package], Ex
    ception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

    PS C:\Windows\system32> Install-Package -Name docker -ProviderName DockerMsftProvider -Force
    Install-Package : Unable to find package providers (DockerMsftProvider).
    At line:1 char:1
    + Install-Package -Name docker -ProviderName DockerMsftProvider -Force
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (Microsoft.Power….InstallPackage:InstallPackage) [Install-Package], E
    xception
    + FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

    I suspect it is the proxy blocking but cannot access it to check. Is it possible to do this behind a very strict proxy? An alternative download location or manual install?

    Reply
  16. robertolabarca

    pls help me.

    .docker. — install in windows 10 A
    .Internet. — NOT
    .DVD windows 2016 — OK

    PLS:

    How to create windows base image. ?

    Reply
  17. Ofer

    When running "docker pull microsoft/windowsservercore" , where are the files going to?

    I do not see anything in the folder I ran the command.

    Reply
    • Michael Friis

      They go to C:\programdata\docker

      You can see images on your machine with `docker images`

      Reply
  18. Brad Jensen

    So does this mean I can make a windows server 2016 container with windows deduplication in it, and then run that container on windows 10?

    Reply
  19. Zonciu Liang

    Hello, I'm wondering how to add registry mirror on windows server 2016?

    Reply
  20. Pedro Alvarez

    Great post! Thank you. Running all accordingly

    Reply
  21. Jeremy

    I'd love to see a demo of deploying to a remote windows 2016 server. Also, if a database were part of a container package (e.g. service a = webapi + database), how would you handle the distribution/sharing of the data file?

    Reply
  22. Ramu

    Hi,

    When I run "docker-compose -f .\docker-compose.windows.yml build" I get a whole heap of errors and exists,

    ERROR: Service 'web' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; dotnet build .\samples\MusicStore.Standalone' returned a non-zero
    code: 1
    ..
    ..
    ..

    ERROR: Service 'web' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; dotnet build .\samples\MusicStore.Standalone' returned a non-zero
    code: 1

    Any ideas?

    Reply
    • Michael Friis

      Please post more details or ask on the Docker Forums or on Stackoverflow

      Reply
  23. osv

    docker for windows can't be installed on Windows 2016 it is just possible on Windows 10.
    Is there a way of running windows and linux based containers on Windows 2016?

    Reply
    • Estanislao

      Containers share host OS. In windows 2016 you will be able to run windows 2016 based containers. Or you can start a linux VM and run your container on it.

      Reply
    • Estanislao

      As i understand, containers share host OS. In windows 2016 you will be able to run windows 2016 based containers. Or you can start a linux VM and run your container on it.

      Reply
  24. jfoliveira

    Hi Michael,

    Could you update your tutorial to use another sample project other than the `MusicStore`. The MusicStore project is broken as already mentioned here – https://github.com/docker/labs/issues/144 – therefore it gets hard for beginners in Docker for Windows to actually follow your step by step.

    Your article was published with good intention but unfortunately, at the time of this writing on 16-Jan-2017, it's not being a fully working tutorial.

    Thanks!

    Reply
  25. sagar

    Hello sir ,

    When i run .exe application on windows container at that time i am getting below errors .
    Docker\Resources\bin\docker.exe: Error response from daemon: container 7da4b32f71a7a0746aa472ae7c20f677ca1153cb75e05b6140a4fd8a758f‌​120f encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"ApplicationName":"","CommandLine":"name.exe/bin / bin/name.exe input1 output","User":"","WorkingDirectory":"C:\\","Environment":{}‌​,"EmulateConsole":fa‌​lse,"CreateStdInPipe‌​":true,"CreateStdOut‌​Pipe":true,"CreateSt‌​dErrPipe"

    Reply
  26. sagar

    here is my docker file
    —————————-
    FROM microsoft/nanoserver
    MAINTAINER name@gmail.com
    COPY result_analysis.exe /bin/
    ENTRYPOINT ["result_analysis.exe/bin"]
    CMD ["/bin/result_analysis.exe", "input1", "output"]

    Reply
  27. Tim

    Hi,
    well written and interesting.

    I´m curious if this would work with an ESXi Server running vSphere 6.5 (Integrated Container) as well.

    You don´t know this by chance right? ^^

    As far as I know the vSphere Container get deployed with a Linux Kernel as base preventing clean Installations of Windows in these.

    Or do you by any chance know a discussion platform for these topics?

    I can´t find anything else then reddit.

    Reply
  28. Neil Devadasan

    Thank you for the post. I am learning a lot by practicing these instructions.

    When I run the docker-compose command I get this ERROR.

    PS C:\musicstore> docker-compose -f .\docker-compose.windows.yml build
    ERROR: The Compose file '.\.\docker-compose.windows.yml' is invalid because:
    services.web.depends_on contains an invalid type, it should be an array
    PS C:\musicstore>

    The docker-compose.windows.yml looks like this when I downloaded from github.

    version: '2.1'
    services:
    db:
    image: microsoft/mssql-server-windows-developer
    environment:
    sa_password: "Password1"
    ACCEPT_EULA: "Y"
    ports:
    – "1433:1433" # REMARK: This is currently required, needs investigation
    healthcheck:
    test: [ "CMD", "sqlcmd", "-U", "sa", "-P", "Password1", "-Q", "select 1" ]
    interval: 1s
    retries: 20
    web:
    build:
    context: .
    dockerfile: Dockerfile.windows
    environment:
    – "Data:DefaultConnection:ConnectionString=Server=db,1433;Database=MusicStore;User Id=sa;Password=Password1;MultipleActiveResultSets=True"
    depends_on:
    db:
    condition: service_healthy
    ports:
    – "5000:5000"

    networks:
    default:
    external:
    name: nat

    Any insight?

    Thanks

    Reply
  29. Lea Abrugena

    Hi Michael,

    I tried this on my Windows 10 machine

    Dockerfile
    From microsoft/windowsservercore
    CMD ["echo", "Hello World"]

    Result:
    PS C:\FSD\Docker\Trial1> docker build -t lea/leatest .
    Sending build context to Docker daemon 2.048kB
    Step 1/2 : FROM microsoft/windowsservercore
    latest: Pulling from microsoft/windowsservercore
    3889bb8d808b: Pulling fs layer
    503d87f3196a: Downloading
    image operating system "windows" cannot be used on this platform

    Please help. Thanks!

    Reply
  30. Michael Curran

    Running into this issue, and yes I am in a 64-bit PS shell , the Install-Module works fine — the Install-Package does not (turned off FW just in case it was in the way).

    PS C:\WINDOWS\system32> Install-Package -Name docker -ProviderName DockerMsftProvider -Force
    Install-Package : The term 'Get-WindowsFeature' is not recognized as the name of a cmdlet, function, script file, or
    operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
    again.
    At line:1 char:1
    + Install-Package -Name docker -ProviderName DockerMsftProvider -Force
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (Microsoft.Power….InstallPackage:InstallPackage) [Install-Package],
    Exception
    + FullyQualifiedErrorId : FailedToDownload,Install-Package,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallP
    ackage

    Reply
  31. Daniel Weicht

    I have installed Docker in Windows Server 2016 and I am having the following issue.

    The daemon.json file has not been installed and I want to change the path directory from C to D. My question is, can I simply create a daemon.sjon file under the following path "C:\Program Files\Docker" and then save the file? Additionally, will the following be enough to Point the D drive
    {
    "graph": "D:\\docker"
    }

    Thank you very much in advance.

    Best regards,
    Daniel

    Reply
    • Michael Friis

      The location of the config file is `c:\programdata\docker`

      You can also change this with `dockerd`:

      net stop docker
      dockerd –unregister-service
      dockerd –register-service -g D:\docker
      net start docker

      Reply
      • Daniel Weicht

        Hi Michael,

        Thank you very much for your response. It worked like a charm :).

        Regards,
        Daniel

        Reply
  32. build your own PC

    nice article thanks for posting this article

    Reply
  33. Phill

    Hi Michael,

    I am using a 2016 datacentre server in Azure.
    I have followed your guide and all is installed after a few tweeks, the containers are created and i have used the latest release of all softwares, when i try to open the music store in a web browser i get the below error.

    C:\MusicStore>docker-compose -f .\docker-compose.windows.yml up
    Starting musicstore_db_1
    Starting musicstore_web_1
    Attaching to musicstore_db_1, musicstore_web_1
    db_1 | VERBOSE: Starting SQL Server
    db_1 | VERBOSE: Changing SA login credentials
    db_1 | VERBOSE: Started SQL Server.
    web_1 | C:\Users\ContainerAdministrator\.nuget\packages\internal.aspnetcore.sdk\1.0.1-rc2-15218\build\Git.targets(15,5): warning : Unable to determine active git branch. [C:\MusicStore\samples\MusicStore\MusicStore.csproj]
    web_1 | C:\Users\ContainerAdministrator\.nuget\packages\internal.aspnetcore.sdk\1.0.1-rc2-15218\build\Git.targets(32,5): warning : Property 'CommitHash' was not set [C:\MusicStore\samples\MusicStore\MusicStore.csproj]
    web_1 | warn: Microsoft.EntityFrameworkCore.Infrastructure.IModelValidator[1]
    web_1 | No type was specified for the decimal column 'Price' on entity type 'Album'. This will cause values to be silently truncated if they do not fit in the default precision and scale. Explicitly specify the SQL server column type that can accomadate all the values using 'ForSqlServerHasColumnType()'. To configure this warning use the DbContextOptionsBuilder.ConfigureWarnings API (event id 'SqlServerEventId.DefaultDecimalTypeWarning'). ConfigureWarnings can be used when overriding the DbContext.OnConfiguring method or using AddDbContext on the application service provider.
    web_1 | warn: Microsoft.EntityFrameworkCore.Infrastructure.IModelValidator[1]
    web_1 | No type was specified for the decimal column 'Total' on entity type 'Order'. This will cause values to be silently truncated if they do not fit in the default precision and scale. Explicitly specify the SQL server column type that can accomadate all the values using 'ForSqlServerHasColumnType()'. To configure this warning use the DbContextOptionsBuilder.ConfigureWarnings API (event id 'SqlServerEventId.DefaultDecimalTypeWarning'). ConfigureWarnings can be used when overriding the DbContext.OnConfiguring method or using AddDbContext on the application service provider.
    web_1 | warn: Microsoft.EntityFrameworkCore.Infrastructure.IModelValidator[1]
    web_1 | No type was specified for the decimal column 'UnitPrice' on entity type 'OrderDetail'. This will cause values to be silently truncated if they do not fit in the default precision and scale. Explicitly specify the SQL server column type that can accomadate all the values using 'ForSqlServerHasColumnType()'. To configure this warning use the DbContextOptionsBuilder.ConfigureWarnings API (event id 'SqlServerEventId.DefaultDecimalTypeWarning'). ConfigureWarnings can be used when overriding the DbContext.OnConfiguring method or using AddDbContext on the application service provider.
    web_1 | Hosting environment: Production
    web_1 | Content root path: C:\MusicStore\samples\MusicStore
    web_1 | Now listening on: http://0.0.0.0:5000
    web_1 | Application started. Press Ctrl+C to shut down.
    db_1 |
    db_1 | TimeGenerated EntryType Message
    db_1 | ————- ——— ——-
    db_1 | 5/10/2017 11:50:18 AM Information None
    db_1 | 5/10/2017 11:50:40 AM Information Using 'xplog70.dll' version '2015.130.1601…
    db_1 | 5/10/2017 11:50:40 AM Information Attempting to load library 'xplog70.dll' i…
    web_1 | fail: Microsoft.AspNetCore.Server.Kestrel[0]
    web_1 | UbReadCb
    web_1 | System.MissingMethodException: Method not found: 'System.IO.Pipelines.ReadableBufferAwaitable System.IO.Pipelines.IPipeReader.ReadAsync()'.
    web_1 | at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketOutput.<StartWrites>d__27.MoveNext()
    web_1 | at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
    web_1 | at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketOutput.StartWrites()
    web_1 | at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketOutput..ctor(IPipe pipe, KestrelThread thread, UvStreamHandle socket, Connection connection, String connectionId, IKestrelTrace log)
    web_1 | at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Connection..ctor(ListenerContext context, UvStreamHandle socket)
    web_1 | at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.ListenerSecondary.ReadStartCallback(UvStreamHandle handle, Int32 status)
    web_1 | at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvStreamHandle.UvReadCb(IntPtr handle, Int32 status, uv_buf_t& buf)
    web_1 |
    web_1 | Unhandled Exception: System.AggregateException: An error occurred while writing to logger(s). (The collection has been marked as complete with regards to additions.) —> System.InvalidOperationException: The collection has been marked as complete with regards to additions.
    web_1 | at System.Collections.Concurrent.BlockingCollection`1.TryAddWithNoTimeValidation(T item, Int32 millisecondsTimeout, CancellationToken cancellationToken)
    web_1 | at Microsoft.Extensions.Logging.Console.Internal.ConsoleLoggerProcessor.EnqueueMessage(LogMessageEntry message)
    web_1 | at Microsoft.Extensions.Logging.Console.ConsoleLogger.WriteMessage(LogLevel logLevel, String logName, Int32 eventId, String message, Exception exception)
    web_1 | at Microsoft.Extensions.Logging.Console.ConsoleLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
    web_1 | at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
    web_1 | — End of inner exception stack trace —
    web_1 | at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
    web_1 | at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelTrace.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
    web_1 | at Microsoft.Extensions.Logging.LoggerExtensions.LogCritical(ILogger logger, String message, Object[] args)
    web_1 | at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.Dispose()
    web_1 | at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Dispose()
    web_1 | at Microsoft.Extensions.DependencyInjection.ServiceProvider.Dispose()
    web_1 | at Microsoft.AspNetCore.Hosting.Internal.WebHost.Dispose()
    web_1 | at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host, CancellationToken token, String shutdownMessage)
    web_1 | at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
    web_1 | at MusicStore.Program.Main(String[] args) in C:\MusicStore\samples\MusicStore\Program.cs:line 52
    musicstore_web_1 exited with code 1

    Reply
  34. JCampbell

    Hi,

    I'm trying to build the Musicstore application in Powershell and I'm getting the following:

    PS C:\Users\jc\Musicstore> docker-compose -f .\docker-compose.windows.yml build
    docker-compose : Traceback (most recent call last):
    At line:1 char:1
    + docker-compose -f .\docker-compose.windows.yml build
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

    File "<string>", line 3, in <module>
    File "compose\cli\main.py", line 64, in main
    File "compose\cli\main.py", line 113, in perform_command
    File "compose\cli\command.py", line 36, in project_from_options
    File "compose\cli\command.py", line 103, in get_project
    File "compose\config\config.py", line 316, in load
    File "compose\config\config.py", line 467, in process_config_file
    File "compose\config\validation.py", line 363, in validate_against_config_schema
    File "compose\config\validation.py", line 393, in load_jsonschema
    IOError: [Errno 2] No such file or directory: u'C:\\Users\\jc\\AppData\\Local\\Temp\\2\\_MEI18~1\\compose\\config\\config_schema_v3.0.json'
    docker-compose returned -1

    When I check Windows Explorer (with hidden files showing) the _MEI18~1 folder doesn't exist.

    Note that I'd had a github error on the previous step (git clone https://github.com/friism/Musicstore) though I read this wasn't a true error – just github writing to stderr when it should've written to stdout (https://github.com/dahlbyk/posh-git/issues/109). And the MusicStore folder seemed to be created ok.

    Thanks,
    John
    PS I'm happy to post elsewhere if this is a docker issue and not a tutorial issue.

    Reply
    • Rene

      Hi John, in case you could not resolve this meanwhile or for anyone else having this problem:
      Looks like a faulty and/or outdated docker-compose executable to me. I had the same error following the installation instructions from training.docker.com where it referenced a docker-compose executable from bintray.com (docker-compose version 1.9.0dev, build 466ebb6).
      The docker docs referenced https://github.com/docker/compose/releases so I tried with a current docker-compose (docker-compose version 1.13.0, build 1719ceb8) and got it working just fine.

      Reply
  35. Aslam

    I am trying to start a container on Win 2016 machine and getting below error –

    PS C:\Windows\system32> docker run -d –name myFirstIISApp -p 80:80 microsoft/iis
    9273be91cab3d36bfe6cd2ca38b5ec29907b631ddbe3440bbcdb4003d187683b
    C:\Program Files\Docker\docker.exe: Error response from daemon: container 9273be91cab3d36bfe6cd2ca38b5ec29907b631ddbe344
    0bbcdb4003d187683b encountered an error during Start: failure in a Windows system call: This operation returned because
    the timeout period expired. (0x5b4).

    Reply
  36. saurabh jain

    Hello i have a container id that runs my app on my local pc after getting docke ip for using this command :-
    docker inspect –format="{{.NetworkSettings.Networks.nat.IPAddress}}" helloimagesdockcont

    when i tried to run this ip another pc it not executed means i need to expose my containe ip with my local network what i need to do my pc havinh windows 10 configuration with docker latest version

    i have tried satic ip rule as well as open firewall using netsh command but still the problem noit resolved please help!!!

    Reply
  37. Theeba Krishnan

    When starting docker service , getting below error

    "fatal: Error starting daemon: Error initializing network controller: Error creating default network: HNS failed with error : The object already exists."

    Your help is really appreciated!!

    Reply
  38. Frank

    I tried to setup the development environment in windows server 2016 with Visual Studio 2017, I got the same error, any solution for this? I know MS recommends development should be on Windows 10 while testing/prod environment should be on Windows server 2016, but I only have windows server 2016, no windows 10.

    1>docker-compose -f "C:\Users\server_admin\Documents\Visual Studio 2017\Projects\WebApplication4\docker-compose.yml" -f "C:\Users\server_admin\Documents\Visual Studio 2017\Projects\WebApplication4\docker-compose.override.yml" -f "C:\Users\server_admin\Documents\Visual Studio 2017\Projects\WebApplication4\docker-compose.vs.release.yml" -p dockercompose4219315891 up -d –no-build
    1>Creating network "dockercompose4219315891_default" with the default driver
    1>HNS failed with error : The parameter is incorrect.
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: The "PrepareForLaunch" task failed unexpectedly.
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: Microsoft.DotNet.Docker.CommandLineClientException: Creating network "dockercompose4219315891_default" with the default driver
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: HNS failed with error : The parameter is incorrect. .
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018:
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: For more troubleshooting information, go to http://aka.ms/DockerToolsTroubleshooting —> Microsoft.DotNet.Docker.CommandLineClientException: Creating network "dockercompose4219315891_default" with the default driver
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: HNS failed with error : The parameter is incorrect.
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at Microsoft.DotNet.Docker.DockerComposeClient.<ExecuteAsync>d__18.MoveNext()
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: — End of inner exception stack trace —
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at Microsoft.DotNet.Docker.DockerComposeClient.<ExecuteAsync>d__18.MoveNext()
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: — End of stack trace from previous location where exception was thrown —
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at Microsoft.DotNet.Docker.DockerWorkspace.<PrepareForLaunchAsync>d__14.MoveNext()
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: — End of stack trace from previous location where exception was thrown —
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at Microsoft.DotNet.Docker.BuildTasks.DockerBaseTask.Execute()
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(192,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
    1>Done building project "docker-compose.dcproj" — FAILED.

    Reply
  39. Alagesan Pandy

    Below is the error I get during the docker-compose build at the step dotnet publish –

    Models\MusicStoreContext.cs(6,36): error CS0246: The type or namespace name 'IdentityUser' could not be found (are you missing a using directive or an assembly reference?) [C:\app\samples\MusicStore\MusicStore.csproj]
    Models\MusicStoreContext.cs(8,18): error CS0311: The type 'MusicStore.Models.ApplicationUser' cannot be used as type parameter 'TUser' in the generic type or method 'IdentityDbContext<TUser>'. There is no implicit reference conversion from 'MusicStore.Models.ApplicationUser' to 'Microsoft.AspNetCore.Identity.IdentityUser'. [C:\app\samples\MusicStore\MusicStore.csproj]
    ForTesting\Mocks\Facebook\TestFacebookEvents.cs(50,62): error CS0246: The type or namespace name 'OAuthRedirectToAuthorizationContext' could not be found (are you missing a using directive or an assembly reference?) [C:\app\samples\MusicStore\MusicStore.csproj]
    ForTesting\Mocks\Google\TestGoogleEvents.cs(50,62): error CS0246: The type or namespace name 'OAuthRedirectToAuthorizationContext' could not be found (are you missing a using directive or an assembly reference?) [C:\app\samples\MusicStore\MusicStore.csproj]
    ForTesting\Mocks\MicrosoftAccount\TestMicrosoftAccountEvents.cs(51,62): error CS0246: The type or namespace name 'OAuthRedirectToAuthorizationContext' could not be found (are you missing a using directive or an assembly reference?) [C:\app\samples\MusicStore\MusicStore.csproj]
    ForTesting\Mocks\Twitter\TestTwitterEvents.cs(44,62): error CS0246: The type or namespace name 'TwitterRedirectToAuthorizationEndpointContext' could not be found (are you missing a using directive or an assembly reference?) [C:\app\samples\MusicStore\MusicStore.csproj]
    ERROR: Service 'web' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; dotnet publish –output /out –configuration Release –framework netcoreapp2.0 –runtime win10-x64 .\samples\MusicStore' returned a non-zero code: 1

    Did anyone face this problem?

    Reply
    • Roger Champagne

      Alagesan, I am getting the same error – Step 12/18. Running on Windows Server 2016 Standard (inside a VMWare VM, don't know if this is relevant), Windows updated as of this morning. Using Docker Enterprise Edition Basic installed via Powershell.

      Reply
    • Roger Champagne

      Was using docker-compose version 1.16.0, and have been told that there are issues with recent versions of this tool. I rolled back to 1.11.2 to no avail.

      There seems to be a missing using directive in MusicStore.Models. Visual Studio suggests adding "using Microsoft.AspNetCore.Identity;", but when I fix it, then there are other compilation errors in the mocks in the "ForTesting" subfolders.

      Reply
  40. fosu

    Hi Michael

    when doing the docker-compose cmd at 12/18,there is a error,how could I fix it?

    —> c952057551cf
    Step 11/18 : ADD samples samples
    —> 1e662eb0a9c0
    Step 12/18 : RUN dotnet publish –output /out –configuration Release –framework netcoreapp2.0 –runtime win10-x64 .\samples\MusicStore
    —> Running in 72bb57b92619
    Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
    Copyright (C) Microsoft Corporation. All rights reserved.

    Models\MusicStoreContext.cs(6,36): error CS0246: The type or namespace name 'IdentityUser' could not be found (are you missing a using directive or an assembly reference?) [C:\app\samples\MusicStore\MusicStore.csproj]
    Models\MusicStoreContext.cs(8,18): error CS0311: The type 'MusicStore.Models.ApplicationUser' cannot be used as type parameter 'TUser' in the generic type or method 'IdentityDbContext<TUser>'. There is no implicit reference conversion from 'MusicStore.Models.ApplicationUser' to 'Microsoft.AspNetCore.Identity.IdentityUser'. [C:\app\samples\MusicStore\MusicStore.csproj]
    ForTesting\Mocks\Facebook\TestFacebookEvents.cs(50,62): error CS0246: The type or namespace name 'OAuthRedirectToAuthorizationContext' could not be found (are you missing a using directive or an assembly reference?) [C:\app\samples\MusicStore\MusicStore.csproj]
    ForTesting\Mocks\Google\TestGoogleEvents.cs(50,62): error CS0246: The type or namespace name 'OAuthRedirectToAuthorizationContext' could not be found (are you missing a using directive or an assembly reference?) [C:\app\samples\MusicStore\MusicStore.csproj]
    ForTesting\Mocks\MicrosoftAccount\TestMicrosoftAccountEvents.cs(51,62): error CS0246: The type or namespace name 'OAuthRedirectToAuthorizationContext' could not be found (are you missing a using directive or an assembly reference?) [C:\app\samples\MusicStore\MusicStore.csproj]
    ForTesting\Mocks\Twitter\TestTwitterEvents.cs(44,62): error CS0246: The type or namespace name 'TwitterRedirectToAuthorizationEndpointContext' could not be found (are you missing a using directive or an assembly reference?) [C:\app\samples\MusicStore\MusicStore.csproj]
    ERROR: Service 'web' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; dotnet publish –output /out –configuration Release –framework netcoreapp2.0 –runtime win10-x64 .\samples\MusicStore' returned a non-zero code: 1

    Reply

Leave a Reply to Neil Devadasan

Click here to cancel reply.

Get the Latest Docker News by Email

Docker Weekly is a newsletter with the latest content on Docker and the agenda for the upcoming weeks.