Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mounting the docker socket using WithBindMount #7077

Open
davidfowl opened this issue Jan 13, 2025 · 0 comments
Open

Allow mounting the docker socket using WithBindMount #7077

davidfowl opened this issue Jan 13, 2025 · 0 comments
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Milestone

Comments

@davidfowl
Copy link
Member

See #5378 (comment) for details:

OK this is all very helpful, thank you @rsking. I think I know what is going on.

Looks like Docker Desktop is treating the host path /var/run/docker.sock in a very special way. It allows to "bind mount" that path into the container even though it does not exist on the host machine at all; instead it silently creates a bind mount into Docker daemon VM. I am quite surprised that it works and I could not find anything about this special treatment in the Docker Desktop documentation, but it kind of makes sense.

Aspire should probably special-case this mount source (/var/run/docker.sock) as well. Specifically

WithAnnotation() results in an unnecessary C:\var\run\docker.sock folder being created because Aspire (DCP specifically) is trying to be helpful and noticed that you are attempting a bind mount from a folder that does not exist on the machine. So it is trying to create that folder for you. We should stop doing that for /var/run/docker.sock.

WithContainerRuntimeArgs() may not work simply because there should be two paramenters passed to it, that is, the way to call it is WithContainerRuntimeArgs("-v", "/var/run/docker.sock:/var/run/docker.sock"). Would appreciate a verification here; this should work.

WithBindMount() does not work because Aspire is trying to compute the absolute path to /var/run/docker.sock and failing at that https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting/ContainerResourceBuilderExtensions.cs#L80 We should not do this for /var/run/docker.sock source.

cc @karolz-ms

@davidfowl davidfowl added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Jan 13, 2025
@davidfowl davidfowl modified the milestones: 9.1, Backlog Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

No branches or pull requests

1 participant