iayti / CleanArchitecture

ASP.NET Core 6 Web API Clean Architecture Solution Template
MIT License
654 stars 120 forks source link

Docker Container is not running on Windows 10 #38

Open AhmadElsayed opened 2 years ago

AhmadElsayed commented 2 years ago

Describe the bug failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c dotnet restore "src/Apps/ProjName.Api/ProjName.Api.csproj"]: exit code: 1

To Reproduce Steps to reproduce the behavior:

  1. Create the new template using dotnet new --install Matech.Clean.Architecture.Template
  2. Downloading the Docker desktop
  3. Going to the folder and running command docker-compose up

Expected behavior The Docker images got up and running

Desktop (please complete the following information):

iayti commented 2 years ago

Hi @AhmadElsayed ,

I tried to switch my windows 10 computer Linux Containers to Windows Containers, but the docker collapse and cannot even run docker run hello-world. I cannot recreate the bug. I have tested it on Linux, macOS, and Windows before.

My guess is that the problem may be on the DockerFile in the API project. I'm leaving the topic open, I'll update when I find a windows machine I can test.

Have a nice coding 😊

AhmadElsayed commented 2 years ago

Hey @iayti

One of the issues in the template generation using the command [dotnet new cas] ​ is having the path wrongly defined in the API Docker file

Instead of COPY ["src/Apps/sample/sample.Api.csproj", "src/Apps/WebApi/"]

It should be COPY ["src/Apps/sample.API/sample.Api.csproj", "src/Apps/WebApi/"]

But that didn't solve the issue with me though .. will keep trying

iayti commented 2 years ago

Hi @AhmadElsayed,

Sorry for my late answer. I tried on the Windows Container and get the error aspnet:5.0-buster-slim doesn't work on Windows Container and I change it to aspnet:5.0 base version.

After this change Api project docker build and run error fixed, but the docker-compose up didn't run. Network Bridge doesn't support the Windows Container.

If you want to use the Windows Container, you must create NAT network for docker-compose

Usefull link

Have a nice coding 😊