Docker changes for Building .Net 8 application targeting Ubuntu 20.0.4 for amd64

Saravanakumar Balachandran 40 Reputation points
2023-12-19T21:43:34.1333333+00:00

Hi,

We are upgrading from .Net 6 to .Net 8. I am trying to update the docker file for building the .Net application and specify .Net 8 version and target Ubuntu 20.0.4 version with amd64 architecture.

Here is the code snippet at the high level

FROM artifactory..../dockerhub-microsoft/dotnet/aspnet:8.0.0-focal-amd64 AS base

WORKDIR /app

Run sed ...

FROM artifactory.../dockerhub-microsoft/dotnet/sdk:8.0.0-focal-amd64 AS build

WORKDIR /src

COPY . .

RUN

....

But it is throwing following error when I specify 20.0.4 image tag 8.0.0-focal-amd64. It works fine for the existing .Net 6 version.

"failed to solve with frontend dockerfile.v0: failed to create LLB definition: artifactory.../dockerhub-microsoft/dotnet/aspnet:8.0.0-focal-amd64: not found"

I could not find the exact 20.0.4 image tag for 8 version online. If I use jammy instead of focal it works fine. But I believe jammy tag targets ubuntu 22.0.4 and I want to target ubuntu 20.0.4. Can you pls. confirm the image tag for .Net 8.0 for ubuntu 20.0.4 or what am I missing here?

Thanks

Saravanakumar.

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
639 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,175 questions
{count} votes

Accepted answer
  1. Anveshreddy Nimmala 2,380 Reputation points Microsoft Vendor
    2023-12-20T08:54:49.2733333+00:00

    Hi Saravanakumar Balachandran,

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    It seems that the Docker image is not available in the artifactory. please modify your Dockerfile to use the ubuntu:20.04 base image.

    FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

    base

    WORKDIR /source

    COPY *.sln .

    COPY aspnetapp/*.csproj ./aspnetapp/

    RUN dotnet restore

    COPY aspnetapp/. ./aspnetapp/

    WORKDIR /source/aspnetapp

    RUN dotnet publish

    FROM mcr.microsoft.com/dotnet/aspnet:8.0

    WORKDIR /app

    COPY

    ENTRYPOINT

    we are using the mcr.microsoft.com/dotnet/sdk:8.0 base image for the build stage and the mcr.microsoft.com/dotnet/aspnet:8.0 base image for the runtime stage.

    Hopes this helps you.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful