Skip to content

docker pull tricky when supporting .NET Core 3.1 and .NET 5.0 #2334

@nycdotnet

Description

@nycdotnet

Describe the Problem

At Namely we've got many .NET Core 3.1 services running in Docker containers with Kubernetes. We've been building our base .NET docker images with a .sh script with lines like this:

docker pull mcr.microsoft.com/dotnet/core/sdk:${DOTNET_VERSION}
docker pull mcr.microsoft.com/dotnet/core/aspnet:${DOTNET_ALPHA_VERSION}

When our developers are testing out the latest .NET version, they can opt-in to the latest Namely container by choosing the alpha label, or they can stay on stable by choosing the latest label.

The problem is now that because .NET 5 is not "Core" anymore, the path in the MCR is different. We had to adapt our build script to do decimal math in bash which is not the greatest. This is the thing we came up with.

# allows you to compare decimal numbers in bash
compare() (IFS=" "
  exec awk "BEGIN{if (!($*)) exit(1)}"
)

if compare "${DOTNET_VERSION} >= 5"; then
  dotnet_container_root_path="dotnet"
else
  dotnet_container_root_path="dotnet/core"
fi

docker pull mcr.microsoft.com/${dotnet_container_root_path}/runtime:${DOTNET_VERSION}

Describe the Solution

Since we have all our services on .NET Core 3.1 today (or .NET 5 RC2) I wonder if there would be any way that this rough edge of the MCR namespace being changed could be smoothed out. Is there any way that the supported .NET Core 3.1 and 2.1 images could be cross posted under the not "core" namespace in MCR? We expect to be on .NET Core 3.1 and 5.0 once it ships for at least a few months, but probably by April 2021 we'll be fully .NET 5.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions