Search code examples
asp.netdockerdocker-composedocker-machine

Unable to deploy the .net application to the Docker Container


I tried to deploy my application to the Docker and I am facing the below issue.

2>docker-compose  -f "C:\KalaiSelvi\Docker_API\WebApplicationFramework\docker-compose.yml" -f "C:\KalaiSelvi\Docker_API\WebApplicationFramework\docker-compose.override.yml" -f "C:\KalaiSelvi\Docker_API\WebApplicationFramework\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose17334395961885382638 --ansi never up -d --build --force-recreate --remove-orphans

2>Error response from daemon: open \\.\pipe\docker_engine_windows: The system cannot find the file specified.

Error Stack trace:

2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: The "PrepareForLaunch" task failed unexpectedly.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: Microsoft.VisualStudio.Containers.Tools.Common.ContainerToolsException: Error response from daemon: open \\.\pipe\docker_engine_windows: The system cannot find the file specified.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at Microsoft.Docker.DockerClient.<ExecuteAsync>d__0.MoveNext()
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at Microsoft.Docker.DockerClientExtensions.<GetServerOperatingSystemAsync>d__8.MoveNext()
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at Microsoft.Docker.Prerequisites.DockerTargetOSCheckPrerequisite.<EvaluateAsync>d__4.MoveNext()
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at Microsoft.Docker.Prerequisites.DockerCompositePrerequisite.<EvaluateAsync>d__3.MoveNext()
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at Microsoft.Docker.BuildTasks.DockerBuildTask.<EvaluateBuildPrerequisitesAsync>d__35.MoveNext()
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at Microsoft.Docker.BuildTasks.DockerBuildTask.<ExecuteAsync>d__34.MoveNext()
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at Microsoft.Docker.BuildTasks.DockerBuildTask.Execute()
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: Error code: DT1005
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: Severity: Error
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: Command line: docker version --format {{.Server.Os}}
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: Command exit code: 1
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: Command output: 
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018: Command error: Error response from daemon: open \\.\pipe\docker_engine_windows: The system cannot find the file specified.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(407,5): error MSB4018:

My docker file content:

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} 

The docker-compose.yml file content

version: '3.4'

services:
  webapplicationframework:
    image: ${DOCKER_REGISTRY-}webapplicationframework
    build:
      context: .\WebApplicationFramework
      dockerfile: Dockerfile

and the docker version is,

C:\Users\RajendranK>docker version
Error response from daemon: open \\.\pipe\docker_engine_windows: The system cannot find the file specified.
Client:
 Cloud integration: v1.0.29
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:08:16 2022
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Why I am getting this error, I have spent 4 days to fix this issue. But, I was unable to fix it.

I tried to switch between Linux and windows containers. But, No luck.

If I create a .NET core application and set the Docker as a Linux container. I can able to deploy applications successfully. But, if I use a normal .NET application and my framework is 4.7.2. I was unable to deploy it.

Any suggestion please??


Solution

  • There seems to be a system issue rather than a code issue. For some reason, the Docker daemon/service is not running on your machine. I don't have experience with Docker engine on Windows (aside from Linux/WSL2 setup), but I'd recommend to try restart the system services for Docker or to reinstall Docker engine completely.

    UPD:

    Folks here suggest that this is actually a bug in the latest version (4.14.0) of Docker engine and recommend downgrading to 4.13.0 to fix it.