microsoft / microsoft/aspire

Windows with docker WSL, having issues with file mapping

Open
#5,117 2 comments 0 reactions 0 assignees View on GitHub
area-app-model wsl
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

I've reported this issue for docker CLI as well: [Docker CLI issue 5306](https://github.com/docker/for-win/issues/14229 )

Code:
```C#
var filePath = "C:\\Users\\michiele\\source\\repos\\tp-aspire-architecture\\tp-aspire-architecture\\init.sql";

var mysql = builder.AddContainer("mysql", "mysql", "5.7.18")
.WithEndpoint(5455, 3306, "mysql")
.WithVolume("mysql_data", "/var/lib/mysql")
.WithAnnotation(new ContainerMountAnnotation(filePath, "/data/application/init.sql", ContainerMountType.BindMount, false));
```

WithBindMount results in the same behaviour.

This results in the docker container that the file is mapped as **directory**.

This is because Aspire maps it to WSL path structure:
`/c/Users/michiele/source/repos/tp-aspire-architecture/tp-aspire-architecture/init.sql`

But when you use docker CLI with windows path structure, docker does map it as file.

I do think this behavior needs resolving in docker CLI and is an inconsistency in there, however we might want to adapt to this from Aspire as well.

### Expected Behavior

_No response_

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .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.