I’m working with Aspire in a .NET 10 RC2 project.
When I run:
aspire publish
it logs that it’s “creating Docker image”, but no Docker image is actually produced. I have ran it with --debug and indeed the only output regarding the docker image is
[DEBUG] Docker is healthy.
[13:37:16] [dbug] DotNetCliRunner: dotnet(6976) stdout: Building container image for resource env-dashboard
[13:37:16] [dbug] DotNetCliRunner: dotnet(6976) stdout: info: Aspire.Hosting.Publishing.ResourceContainerImageBuilder[0]
[13:37:16] [dbug] DotNetCliRunner: dotnet(6976) stdout: Building container image for resource postgres
[DEBUG] Task 031e1486-9fe3-4346-8f9c-f2b3194de179 (012efe2c-0f9a-4373-9899-d032f6808562): Building image: asr-invest
[13:37:16] [dbug] DotNetCliRunner: dotnet(6976) stdout: info: Aspire.Hosting.Publishing.ResourceContainerImageBuilder[0]
[13:37:16] [dbug] DotNetCliRunner: dotnet(6976) stdout: Building container image for resource asr-invest
[13:37:16] [dbug] DotNetCliRunner: dotnet(6976) stdout: info: Aspire.Hosting.Publishing.ResourceContainerImageBuilder[0]
[13:37:16] [dbug] DotNetCliRunner: dotnet(6976) stdout: Starting .NET CLI with arguments: publish "C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj" --configuration Release /t:PublishContainer
/p:ContainerRepository="asr-invest"
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: info: Aspire.Hosting.Publishing.ResourceContainerImageBuilder[0]
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: dotnet publish C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj (stdout): Determining projects to restore...
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: info: Aspire.Hosting.Publishing.ResourceContainerImageBuilder[0]
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: dotnet publish C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj (stdout):
C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj : warning NU1510: PackageReference Microsoft.AspNetCore.SignalR.Common will not be pruned. Consider removing this package from your dependencies, as it
is likely unnecessary.
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: info: Aspire.Hosting.Publishing.ResourceContainerImageBuilder[0]
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: dotnet publish C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj (stdout):
C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj : warning NU1510: PackageReference Microsoft.AspNetCore.SignalR.Core will not be pruned. Consider removing this package from your dependencies, as it
is likely unnecessary.
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: info: Aspire.Hosting.Publishing.ResourceContainerImageBuilder[0]
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: dotnet publish C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj (stdout):
C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj : warning NU1510: PackageReference Microsoft.AspNetCore.SignalR.Protocols.Json will not be pruned. Consider removing this package from your
dependencies, as it is likely unnecessary.
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: info: Aspire.Hosting.Publishing.ResourceContainerImageBuilder[0]
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: dotnet publish C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj (stdout):
C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj : warning NU1903: Package 'Microsoft.Build.Tasks.Core' 17.14.8 has a known high severity vulnerability,
https://github.com/advisories/GHSA-w3q9-fxm7-j8fq
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: info: Aspire.Hosting.Publishing.ResourceContainerImageBuilder[0]
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: dotnet publish C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj (stdout):
C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj : warning NU1903: Package 'Microsoft.Build.Utilities.Core' 17.14.8 has a known high severity vulnerability,
https://github.com/advisories/GHSA-w3q9-fxm7-j8fq
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: info: Aspire.Hosting.Publishing.ResourceContainerImageBuilder[0]
[13:37:17] [dbug] DotNetCliRunner: dotnet(6976) stdout: dotnet publish C:\Users\st.ha\source\repos\asr-invest\ASR-Invest\ASR-Invest.csproj (stdout): All projects are up-to-date for restore.
[DEBUG] Task 031e1486-9fe3-4346-8f9c-f2b3194de179 (012efe2c-0f9a-4373-9899-d032f6808562): COMPLETED - Building image: asr-invest
[DEBUG] Building image for asr-invest completed
[DEBUG] Step 012efe2c-0f9a-4373-9899-d032f6808562: COMPLETED - Building container images completed
Running dotnet publish itself produces no output files either.
AppHost:
var builder = DistributedApplication.CreateBuilder(args);
var env = builder.AddDockerComposeEnvironment("env");
var postgres = builder.AddPostgres("postgres")
.WithLifetime(ContainerLifetime.Persistent)
.WithDataVolume();
var postgresdb = postgres.AddDatabase("db");
var myservice = builder.AddProject<Projects.ASR_Invest>("asr-invest")
.WithReference(postgresdb)
.WaitFor(postgresdb)
.PublishAsDockerComposeService((resource, service) =>
{
service.Name = "asr-invest";
service.Ports.Add("8080:8080");
service.Restart = "always";
});
builder.Build().Run();
AppHost references Aspire packages:
<PackageReference Include="Aspire.Hosting" Version="9.5.2" />
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.5.2" />
<PackageReference Include="Aspire.Hosting.Orchestration.linux-x64" Version="9.5.2" />
What I’ve tried:
- Running
dotnet publishon the AppHost: succeeds, but produces no publish output. - Running
aspire publish: goes through sucessfully but doesnt create an actual docker image.
Does anyone know what the problem is or how to debug this better.
dotnet publishcan generate images directly, and I'll bet you'll find the images for the ApiService and WebFront in your Docker registry already. Your code asked for adocker-composedeployment. Thedocker-compose.yamlshould be inaspire-outputpublishgenerates intermediate assets - images for every service/project and compose files with unresolved placeholders. When you deploy to an orchestrator (Kubernetes, Docker Compose etc)), Aspire will create the containers based on the images and variables you provide and setup up the orchestrator so the containers talk to each other.dotnet publishworks perfectly well. It does produce binaries and executables in thebin/Release.../publishfolder, that's its job. It doesn't produce a Docker image unless you use/t:PublishContainer.