Nicolas Wälti
Nicolas Wälti

Reputation: 13

.net Core - compatibility of docker images

According to https://devblogs.microsoft.com/dotnet/announcing-net-core-3-0/, the newest version of .NET core should be backward compatible with the previous versions.

However, building a docker image with 2.2sdk won't run on a container with runtime 3.0... Am I missing something or is it the normal behavior?

Upvotes: 0

Views: 275

Answers (1)

voracious
voracious

Reputation: 900

There is no mention of that in the linked article?

What you are experiencing is normal behavior. Major versions are not backwards compatible (for runtimes).

In your case running a .net core 2.2 app will not work on an image with a .net core 3.0 runtime.

You can read more about version selection where the following is mentioned:

The host chooses the latest patch version installed on the machine. For example, if you specified netcoreapp2.0 in your project file, and 2.0.4 is the latest .NET runtime installed, the 2.0.4 runtime is used.

If no acceptable 2.0.* version is found, a new 2.* version is used. For example, if you specified netcoreapp2.0 and only 2.1.0 is installed, the application runs using the 2.1.0 runtime. This behavior is referred to as "minor version roll-forward." Lower versions also won't be considered. When no acceptable runtime is installed, the application won't run.

A few usage examples demonstrate the behavior, if you target 2.0:

  • 2.0 is specified. 2.0.5 is the highest patch version installed. 2.0.5 is used.
  • 2.0 is specified. No 2.0.* versions are installed. 1.1.1 is the highest runtime installed. An error message is displayed.
  • 2.0 is specified. No 2.0.* versions are installed. 2.2.2 is the highest 2.x runtime version installed. 2.2.2 is used.
  • 2.0 is specified. No 2.x versions are installed. 3.0.0 is installed. An error message is displayed.


They also mention roughly adhering to semantic versioning here:

MAJOR is incremented when:

  • Significant changes occur to the product, or a new product direction.
  • Breaking changes were taken. There's a high bar to accepting breaking changes.
  • An old version is no longer supported.
  • A newer MAJOR version of an existing dependency is adopted.

Upvotes: 1

Related Questions