Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Breaking change]: AddDockerfile/WithDockerfile default container image name and tag changed in Aspire 9.1 #2557

Open
1 of 3 tasks
DamianEdwards opened this issue Feb 7, 2025 · 0 comments · May be fixed by #2566
Open
1 of 3 tasks
Assignees
Labels
⛓️‍💥 breaking-change Issues or PRs tracking breaking changes. doc-idea Indicates issues that are suggestions for new topics [org][type][category] in-pr okr-freshness OKR: Freshness of content Pri1 High priority, do before Pri2 and Pri3 🗺️ reQUEST Triggers an issue to be imported into Quest.

Comments

@DamianEdwards
Copy link
Member

Description

In Aspire 9.1, the default container image name and tag assigned to the container resource when using AddDockerfile or WithDockerfile are changing.

Version

Other (please put exact version in description textbox)

Previous behavior

In Aspire 9.0:

  • the default container image name used was based on this format: {ResourceName}-image-{HashOfAppHostDirectory}
  • the default container tag used was simply latest

New behavior

In Aspire 9.1:

  • the default container image name used is now simply the resource name lowercased
  • the default container tag used is now a hash that's derived from the app host directory combined with a timestamp of when the method was called.

Type of breaking change

  • Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • Behavioral change: Existing binaries might behave differently at run time.

Reason for change

The previous behavior caused the bug dotnet/aspire#7462 as the resource name wasn't properly sanitized to be a safe container image name, didn't result in very friendly container names when using Dockerfiles, and resulted in images simply tagged as "latest" on every build/publish, potentially making it difficult to roll-back deployments.

Recommended action

Users should be aware that the generated image names and tags are now different to what they'd previously been and update any dependent deployment tools, scripts, and processes accordingly.

Note that the default image name and tag can be overridden by calling WithImage and WithImageTag on the IResourceBuilder<ContainerResource> respectively

Affected APIs

  • Aspire.Hosting.ContainerResourceBuilderExtensions
    • AddDockerfile(this IDistributedApplicationBuilder builder, [ResourceName] string name, string contextPath, string? dockerfilePath = null, string? stage = null)
    • WithDockerfile<T>(this IResourceBuilder<T> builder, string contextPath, string? dockerfilePath = null, string? stage = null) where T : ContainerResource
@DamianEdwards DamianEdwards added doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 ⛓️‍💥 breaking-change Issues or PRs tracking breaking changes. labels Feb 7, 2025
@dotnetrepoman dotnetrepoman bot added the ⌚ Not Triaged Not triaged label Feb 7, 2025
@DamianEdwards DamianEdwards changed the title [Breaking change]: AddDockerfile/WithDockerfil default container image name and tag changed in Aspire 9.1 [Breaking change]: AddDockerfile/WithDockerfile default container image name and tag changed in Aspire 9.1 Feb 7, 2025
@IEvangelist IEvangelist added 🗺️ reQUEST Triggers an issue to be imported into Quest. okr-freshness OKR: Freshness of content and removed ⌚ Not Triaged Not triaged labels Feb 13, 2025
@dotnetrepoman dotnetrepoman bot added 🗺️ mapQUEST Only used as a way to mark an issue as updated. RepoMan should instantly remove it. and removed 🗺️ mapQUEST Only used as a way to mark an issue as updated. RepoMan should instantly remove it. labels Feb 13, 2025
@IEvangelist IEvangelist moved this from 🔖 Ready to 👀 In review in dotnet/docs February 2025 sprint project Feb 13, 2025
@dotnetrepoman dotnetrepoman bot added 🗺️ mapQUEST Only used as a way to mark an issue as updated. RepoMan should instantly remove it. and removed 🗺️ mapQUEST Only used as a way to mark an issue as updated. RepoMan should instantly remove it. labels Feb 13, 2025
@IEvangelist IEvangelist linked a pull request Feb 13, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⛓️‍💥 breaking-change Issues or PRs tracking breaking changes. doc-idea Indicates issues that are suggestions for new topics [org][type][category] in-pr okr-freshness OKR: Freshness of content Pri1 High priority, do before Pri2 and Pri3 🗺️ reQUEST Triggers an issue to be imported into Quest.
Projects
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

2 participants