Can't run docker container because can't find dotnet image

Viewed 21

I am working through Russ McKendrick's Mastering Docker, in chapter 5. When I try to build the first docker-compose application from his github repository, I get the following error:

Step 1/5 : FROM microsoft/dotnet:2.0.0-sdk pull access denied for microsoft/dotnet, repository does not exist or may require 'docker login': denied: requested access to the resource is denied ERROR: Service 'worker' failed to build : Build failed

I have logged in to the command line with command docker login successfully and it still gives me the message.

The dockerhub microsoft dotnet sdk page https://hub.docker.com/_/microsoft-dotnet-sdk does not help out too much, even though it comes up when googling microsoft/dotnet:2.0.0-sdk. The 2.0.0 sdk does not show up there. Is the microsoft/dotnet:2.0.0-sdk no longer on docker hub? If that is the case, where is it available?

1 Answers

This is a case of working with out-of-date material in the software world. It changes faster than print can manage.

The .NET container images are no longer hosted directly in the Docker Hub container registry. This change was announced in May 2021 and became effective in August 2021. As a replacement of Docker Hub, all .NET container images have been hosted on the Microsoft Container Registry (MCR) since 2019.

Based on the version number you're attempting to access, that represents .NET Core 2.0 which has been out of support since Oct 1, 2018. Because it was out of support prior to the migration from Docker Hub to MCR, no 2.0 tags are available in MCR.

The earliest .NET version still available on MCR is .NET Core 2.1. This version is also out of support since August 2021, but that's as close as you're going to be able to get to have something which is likely still compatible with the material in the book. You can see a full tag list of the SDK images at https://mcr.microsoft.com/v2/dotnet/sdk/tags/list.

So I would recommend replacing microsoft/dotnet:2.0.0-sdk with mcr.microsoft.com/dotnet/sdk:2.1. That would also require you to change the target .NET version in your .NET project files from 2.0 to 2.1.

Related