dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
2.98k stars 280 forks source link

Aspier.Hosting.Dcp.dcpctrl.ContainerReconciler path error #4000

Closed joshmouch closed 2 weeks ago

joshmouch commented 2 weeks ago

Hi, I'm going outside the box a little here, and trying to override the otel collector the Aspire Dashboard/AppHost uses so that I can also share the collector with other processes.

When I get to the DistributedAppBuilder.AddResource()......WithVolume() part, I was expecting to be able to enter in docker volume info just like they would appear in a docker-compose.yaml file. At least in Visual Studio, if you have a docker-compose, relative paths in it will be relative to your Solution folder.

So here's what I'd like to pass into WithVolume():

.WithVolume("./Otel/Config", "/config")

However, I can't get past the following error. I've tried both absolute and relative paths, and I've tried them both with both backslashes and forward slashes.

Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler[0]

      could not create the container    {"Container": {"name":"opentelemetrycollector"}, "Reconciliation": 2, "error": "CreateContainer command returned error code 1 Stdout: '' Stderr: 'Error response from daemon: create S:\\Source\\.....\\AppHost\\bin\\Debug\\net8.0\\Otel\\Config: \"S:\\\\Source\\\\......\\\\AppHost\\\\bin\\\\Debug\\\\net8.0\\\\Otel\\\\Config\" includes invalid characters for a local volume name, only \"[a-zA-Z0-9][a-zA-Z0-9_.-]\" are allowed. If you intended to pass a host directory, use absolute path\n'"}