-1

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:

  1. Running dotnet publish on the AppHost: succeeds, but produces no publish output.
  2. 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.

4
  • The log you posted doesn't show anything wrong. An image isn't the same thing as a Dockerfile. dotnet publish can 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 a docker-compose deployment. The docker-compose.yaml should be in aspire-output Commented Oct 27 at 13:37
  • If you check the Aspire publishing and deployment overview you'll see that publish generates 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. Commented Oct 27 at 13:40
  • @PanagiotisKanavos I have checked my docker registry it is not creating an image, it creates the compose file perfectly fine. I have pretty much the exact same set up for another project in .net 9 where publish creates me the images and running dotnet publish itself also creates some output. Like I said in this project dotnet publish doesnt create ANY output files. Commented Oct 29 at 7:51
  • And on my machine, it does. You're almost certainly looking at the wrong place. You haven't posted anything that shows there are no outputs and the fact you got a compose file means there is output - the compose file itself is the publishing output of the AppHost. The other service projects are published as images. Also dotnet publish works perfectly well. It does produce binaries and executables in the bin/Release.../publish folder, that's its job. It doesn't produce a Docker image unless you use /t:PublishContainer. Commented Oct 29 at 8:14

1 Answer 1

0

I have found the problem. I went through my project and fixed every warning I had. After that everything started working as expected. I cant narrow down exactly what warning caused this issue. I still find it strange though that aspire publish and dotnet publish both did not give me any errors or warnings regarding this issue.

Sign up to request clarification or add additional context in comments.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.