dotnet / aspire

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

Orchestration support for BOTH Windows & Linux Containers #855

Open gerneio opened 9 months ago

gerneio commented 9 months ago

Support for specifying that a container runs on a windows or linux worker node (i.e. in cases where I need to run both linux and windows container images).

mitchdenny commented 9 months ago

Dupe of #854

gerneio commented 9 months ago

IMO, These issues are two different requests (I created both). One is asking for library support for transforming Aspire inctructions to the correct docker instructions for a windows container, while the other (this one) is about supporting the ability to orchestrate & run both Linux and Windows containers at same time. I would have cramed it into the other ticket, but i feel like the two asks are fundamentally different.

mitchdenny commented 9 months ago

That is fair. In that case it isn't a dupe, but it is also not something we can tackle in Aspire. Aspire (presently) relies on Docker Desktop for its container support, and Docker Desktop can only support Windows or Linux containers, but not both at the same time. So until that constraint disappears we won't be able to address this.

mitchdenny commented 9 months ago

I will reopen to collect feedback for peoples interest in this if Docker Desktop does end up adding support for concurrent Windows and Docker containers.

gerneio commented 9 months ago

Yup I understand docker desktop being that limitation, but thats also why I specifically only mentioned orchestration, since this would also apply to other environments such as when using Kubernetes (or whichever), where it "should" be possible (not necessarily from same worker node) to have Aspire output runnable configuration to produce that type of dual hosts configuration. There are other issues that are requesting kubernetes implementation, and it seems like the team is receptive of making that happen, so that's great. But this request would be on top of that with being able to configure both a Linux and Windows worker node from a single Aspire configuration. So I would imagine that would require some API changes to specify what worker node a particular 'AddContainer' call goes to. Just throwing out some suggestions...

Speaking of Docker specifically, one thing that might help is if you look at the CLI docs for docker context you can control which OS host you target for a docker run command, by using the -c switch. Examples:

Run on Linux host specifically: docker -c desktop-linux run hello-world

Run on Windows host specifically:

docker -c desktop-windows run hello-world

Soooo if we can control the cmd line args sent to the docker run command that dotnet run ultimately calls when running the AppHost project, then that kinda gets what I'm asking for here, but probably only for a dev environment (which is fine for now I think)

Anyways, just a few thoughts... thanks for re-opening!

davidfowl commented 8 months ago

cc @karolz-ms

davidfowl commented 8 months ago

There's no plan to support windows containers in the short term. If there's more demand and small things we can change to unblock the scenario, we might do that.