# Dockerize C# Web Api With Multiple Layers

**URL:** <https://forums.docker.com/t/dockerize-c-web-api-with-multiple-layers/124484>\
**Category:** Docker Hub\
**Tags:** docker, build\
**Created:** [May 12, 2022, 3:37pm UTC](https://forums.docker.com/t/dockerize-c-web-api-with-multiple-layers/124484 "2022-05-12T15:37:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![macikdev](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/macikdev/32/34513_2.png) [@macikdev](https://forums.docker.com/u/macikdev)\
**Post date:** [May 12, 2022, 3:37pm UTC](https://forums.docker.com/t/dockerize-c-web-api-with-multiple-layers/124484/1 "2022-05-12T15:37:19Z")

</div>

Hi, I am trying to dockerize my project which consists of Api where dockerfile, Core, Domain, Security, DataAccess. However when I try to build image it fails as it’s missing something ex.

 ![docker](https://global.discourse-cdn.com/docker/original/3X/a/2/a29bdd2dc7d96993eb2d505fe91f8cb47bddd588.jpeg)

My docker file looks like this:

```auto
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["Api.csproj", "Api/"]
RUN dotnet restore "Api/Api.csproj"
COPY . .
WORKDIR "/src/Api"
RUN dotnet build "Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Api.dll"]

```

I’ve tried more than 10 combinations and look for solutions however with no luck does anyone know how to solve this? Thanks in advance.
