Skip to content

Using .AddDockerfile() forces the resource name to be lowercase #7462

@sfields-metabolon

Description

@sfields-metabolon

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

All of the resources in my Aspire project have names that are using PascalCase. I tried adding a new resource that is built from a Dockerfile, but I'm getting the error invalid tag "MyResourceName-image-b3a94344fc439fed1ba4f80c352c4fb0417a6162:latest": repository name must be lowercase.

This happens because the WithDockerfile() extension is using the name of the resource to generate the name of the docker image, but it does not provide a way to separate the naming of the image from the name of the resource.

Expected Behavior

The AddDockerfile() and WithDockerfile() extensions should provide an overload that allows users to influence the naming of the image so that it does not have to be tied to the naming of the Resource.

Steps To Reproduce

var builder = DistributedApplication.CreateBuilder(args);

builder.AddDockerfile("MyResourceName", ".");

builder.Build().Run();

Exceptions (if any)

invalid tag "MyResourceName-image-b3a94344fc439fed1ba4f80c352c4fb0417a6162:latest": repository name must be lowercase

.NET Version info

.NET SDK:
 Version:           9.0.102
 Commit:            cb83cd4923
 Workload version:  9.0.100-manifests.43af17c7
 MSBuild version:   17.12.18+ed8c6aec5

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.26100
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.102\

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.1
  Architecture: x64
  Commit:       c8acea2262

.NET SDKs installed:
  8.0.405 [C:\Program Files\dotnet\sdk]
  9.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Anything else?

.NET Aspire Version: 9.0.0

Metadata

Metadata

Assignees

Labels

area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationbreaking-changeIssue or PR that represents a breaking API or functional change over a prerelease.

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions