skip to Main Content

I am working on a project which is based on ASP.NET Core 2.2.8, and I am planning to use docker for this project. The issue is I am getting this error when running the docker file

mcr.microsoft.com/dotnet/aspnet:2.2: not found

I have read some posts that .NET Core 2.2 is out of support and the images are removed. And the option is to upgrade the project. In my case I cannot upgrade the project from .NET Core 2.2. The reason is we are trying to use the Huawei cloud service stage, for that the supported .Net core versions are 2.0.9 and later, and versions earlier than 3.0

https://support.huaweicloud.com/intl/en-us/productdesc-servicestage/ss_productdesc_0001.html

Is there a way to add docker for my project?

2

Answers


  1. Chosen as BEST ANSWER

    We can use the alternative docker images from the docker hub.

    docker pull vminnovations/dotnet-aspnet:2.2.8

    docker pull vminnovations/dotnet-sdk:2.2

    Using the above mentioned images are simple and easy. I have created a test project and added the images. It is working fine

    enter image description here


  2. as you said, the 2.2 is no longer supported. As I was stuck in a similar situation in one of my projects, I used this image. It works fine but use it at your own risk.

    As a plus, you can also use this Dockerfile for the base image of your project. It creates a big Docker image, but at least it works.

    FROM buildpack-deps:stretch-scm
    # Install .NET CLI dependencies
    RUN apt-get update 
        && apt-get install -y --no-install-recommends 
            libc6 
            libgcc1 
            libgssapi-krb5-2 
            libicu57 
            liblttng-ust0 
            libssl1.0.2 
            libstdc++6 
            zlib1g 
            nuget 
        && rm -rf /var/lib/apt/lists/*
    # Install .NET Core SDK
    ENV DOTNET_SDK_VERSION 2.2.300
    RUN curl -SL -k --output dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz 
        && dotnet_sha512='1d660a323180df3da8c6e0ea3f439d6bbec29670d498ac884f38bf3cdffbb041c7afff66171cdfd24c82394b845b135b057404def1fce9f206853726382bc42b' 
        && echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - 
        && mkdir -p /usr/share/dotnet 
        && tar -zxf dotnet.tar.gz -C /usr/share/dotnet 
        && rm dotnet.tar.gz 
        && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
    # Configure web servers to bind to port 80 when present
    ENV ASPNETCORE_URLS=http://+:80 
        # Enable detection of running in a container
        DOTNET_RUNNING_IN_CONTAINER=true 
        # Enable correct mode for dotnet watch (only mode supported in a container)
        DOTNET_USE_POLLING_FILE_WATCHER=true 
        # Skip extraction of XML docs - generally not useful within an image/container - helps performance
        NUGET_XMLDOC_MODE=skip
    

    Build it using this and use it in your project.

    docker build -t dotnet:2.2 . 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search