microsoft / microsoft/aspire

Streamline permissions when creating a volume

Open
#15,316 0 comments 0 reactions 0 assignees View on GitHub
area-integrations
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

### Is your feature request related to a problem? Please describe the problem.

When creating a volume for a container that doesn't run as root, you'll need to set permissions on the volume via the `WithContainerFiles` api, but doing this through the `WithContainerFiles()` api is not entirely obvious.

### Describe the solution you'd like

One solution would simply be to add this to the documentation at https://aspire.dev/fundamentals/persist-data-volumes/ (And perhaps this should be done until API work is done), but this feels like a common enough scenario that it should be handled natively via `WithVolume()` (e.g. by allowing an `owner` to be passed. (e.g. `WithVolume("/mnt/whatever", owner: 1000`)

### Additional context

Dynamo DB is an example where this is needed. (Although you won't see an error until you try to do your first operation against the db)

```cs
var dynamoDb = builder.AddContainer("dynamodb", "amazon/dynamodb-local")
.WithImageRegistry("docker.io")
.WithIconName("Database")
.WithLifetime(ContainerLifetime.Persistent)
.WithHttpEndpoint(targetPort: 8000)
.WithArgs("-jar", "DynamoDBLocal.jar", "-dbPath", "/mnt/data")
.WithVolume("dynamodb-data", "/mnt/data")
.WithContainerFiles("/mnt", [
new ContainerDirectory {
Name = "data",
Owner = 1000
}])
.WithHttpHealthCheck(statusCode: 400);
```

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.