Multiple asp.net core versions in single docker

For now I have asp.net 3.1.8 in my docker(my first project works on it). I add second project with diffrent version, its asp.net 2.1.0, its not possible for me to change it from project side. When I use some function from last added project I got this error:

The framework 'Microsoft.NETCore.App', version '2.1.0' was not found.
  - The following frameworks were found:
      3.1.8 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Its possible to add second version asp.net 2.1.0 to docker?

This is hierarchy in my docker file. I want to add version 2.1.0 here:
enter image description here

Dockerfile:

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base

WORKDIR /app
EXPOSE 44399 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["Project1.Api/Project1.Api.csproj", "Project1.Api/"]
COPY ["Project2.Test/Project2.Test.csproj", "Project1.Test/"]
RUN dotnet restore "Project1.Api/Project1.Api.csproj"
COPY . .
WORKDIR "/src/Project1.Api"
RUN dotnet build "Project1.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Project1.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
ENV ASPNETCORE_URLS http://*:44399
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Project1.Api.dll"]

Source: Docker Questions