microsoft / microsoft/aspire

Failure to copy file into container should show in resource logs

Open
#8,739 2 comments 0 reactions 0 assignees View on GitHub
area-app-model area-dashboard
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

If a file fails to copy into a container with the new Container Files API, the error shows up in the App Host console logs, but I'd expect it to show up in the resource logs on the dashboard.

### Expected Behavior

Image

### Steps To Reproduce

```cs
var redis = builder.AddRedis("redis");
redis.WithContainerFiles("/does/not/exist", [
new ContainerFile{
Name="foo",
Contents ="bar"
}]);
```

### Exceptions (if any)

```
fail: Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler[0]
could not copy file to the container {"Container": {"name":"redis-pkxjdztq"}, "Reconciliation": 11, "ContainerName": "redis-pkxjdztq", "ContainerID": "e089fc5977390412cd2ce8f4cf4587d51a5a4e52c5df5415558d0f2e9bb56b7d", "Destination": "/does/not/exist", "error": "docker command 'CopyFile' returned with non-zero exit code 1: command output: Stdout: '' Stderr: 'destination \"e089fc5977390412cd2ce8f4cf4587d51a5a4e52c5df5415558d0f2e9bb56b7d:/does/not/exist\" must be a directory\n'"}
```

### .NET Version info

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.