Skip to content

I want to be able to run, and build Linux and Windows (LCOW) containers simultaneously.  #79

Open

Description

@bplasmeijer

Tell us about your request
I want to be able to run and build Linux and Windows (LCOW) containers simultaneously.

Which service(s) is this request for?
docker build, and docker-compose

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
At this moment, I am using the (LCOW) experimental feature to run Linux and Windows containers simultaneously. The option to work streamless with Linux and Windows container is hard, because of the switch context option.

Are you currently working around the issue?

  • Switch context when building Linux images.
  • Switch setting back to windows containers, and pull Linux image in (LCOW) mode.

Additional context
The new 20H1 WSL docker integration is a great new feature, and I love it, but integration requires Linux mode. I do lose my windows context.
Issue #78 describes building both Linux and windows images in parallel on windows.

LCOW is great but lingering in limbo. There are many solutions where Windows and Linux containers work together.

Activity

  1. added
    community_new
    on Apr 29, 2020
  2. added
    docker_desktop
    on May 5, 2020
  3. stephen-turner commented on May 5, 2020

    @stephen-turner

    See #78 for more details.

  4. 0x53A commented on May 5, 2020

    @0x53A

    For me the important part is just building. Yeah, running both in parallel would be nice, but not strictly required.

    Our dockerfiles don't do anything fancy, just copy a folder, set an environment variable and set the entry point.

    So I'd also be happy with some other tool. Maybe with WSL2 we can invoke buildkit through WSL or something, idk.

  5. thomasoatman commented on May 26, 2020

    @thomasoatman

    Hi. I am working on moving our build and testing environment to Docker Containers.
    We ship Linux and Windows components and thus need support for both.
    During testing, we require a Windows client container talking to a database in Linux container.
    So the lack of dual support is killing my efforts.
    thank you

  6. erdtsieck commented on Jul 12, 2020

    @erdtsieck

    We're bound to windows containers due to the use of 'windows authentication' in some of our services and because of some SLA's. We do use some linux containers like consul and traefik. Not being able to mix Windows and Linux containers prevents our team from starting to use WSL2.

  7. deleted a comment from conioh on Nov 16, 2020
  8. deleted a comment from conioh on Nov 18, 2020
  9. deleted a comment from sirlatrom on Nov 18, 2020
  10. MathiasMagnus commented on Nov 25, 2020

    @MathiasMagnus

    I am working on upgrading our CI process to allow testing locally. Both GitHub Actions and GitLab CI don't allow running pipelines locally (of course, they weren't designed to do that). Generally I was advised to move away from the feature set of any CI runner and put as much logic into (shell) scripts as possible. Heeding that advice, I'm working on a CMake module (because all of our build automation is CMake anyway) which is able to run CI tasks locally.

    Pipeline definition for GitLab and GitHub remain YAML files which do not much more than define the test matrix, distribute the work to runners and invoke a single script on every pipeline stage. The CMake module is an auxiliary project commited into version control.

    • CMake configuration step allows customizing the "local runner", selecting some subset of the test matrix one wishes to test for.
    • The build step builds the images (from Dockerfiles from within the repo), ideally in parallel.
    • CTest runs the same shell scripts which ordinary CI does (actually, they are CMake scripts too, invoked as cmake -P Build.cmake for eg.) in the correct order with dependency tracking inside Docker containers. Tests again ought to run in parallel. (Tests would get labels based on which test matrix elements they inherit, one could select some subset of the test matrix through ordinary CTest CLI args.)

    It would be rapid response CI runs without involving remote entities, possibly even run totally offline.

    I may be able to orchestrate the entire thing having CMake communicate with two daemons, one locally inside Windows and one running inside WSL2, but setup becomes way more complicated, not to mention having to bind the lifetime of the Linux daemon to a long running Windows process (service?), instead of it being the same daemon which is running on the Windows host anyway.

  11. profblackjack commented on Dec 29, 2020

    @profblackjack

    My org has .net framework applications I'm looking to containerize, and I would love to be able to mix Linux and windows containers on dev machines for a local development environment more reflective of our deployed environments

  12. MarkLFT commented on Dec 30, 2020

    @MarkLFT

    I also would find it extremely useful to be able to run both Windows and Linux containers on a single host. We have many scenarios where it is required we run both types of containers in a single installation.

  13. derWallace commented on Jan 11, 2021

    @derWallace

    For my org using this feature would help us quite a lot as well. We have some legacy components which require to mix Linux containers with Windows containers. Manually switching on the Docker Desktop between Linux containers and Windows containers all the time is quite cumbersome for our developers.

  14. rompic commented on Jan 11, 2021

    @rompic

    For my org using this feature would help us quite a lot as well. We have some legacy components which require to mix Linux containers with Windows containers. Manually switching on the Docker Desktop between Linux containers and Windows containers all the time is quite cumbersome for our developers.

    +1

    Afaik it is possible via the DockerCLI

  15. bplasmeijer commented on Mar 11, 2021

    @bplasmeijer
    Author

    @nebuk89 any update?

  16. 49 remaining items

  17. thaJeztah commented on May 2, 2023

    @thaJeztah
    Member

    Oh! Sorry I now see I @-mentioned the wrong person (sorry for that) 🙈

  18. andrewtek commented on May 2, 2023

    @andrewtek

    Thanks for the update @mloskot and @thaJeztah . I did try out that article, but it did not work for me. As @thaJeztah said, the feature was deprecated.

    For my situation, I found that I could not run SOLR using LCOW, but it runs great using WSL2. I love that SOLR has done so much to help the community with pre-made images and documentation to get up and running,
    https://solr.apache.org/guide/solr/latest/deployment-guide/solr-in-docker.html

    Unfortunately, if you need to work on an ASP.NET Framework application, you cannot benefit from those SOLR images. Is there a technical reason why the deprecated feature cannot be re-implemented with WSL2?

  19. thaJeztah commented on May 2, 2023

    @thaJeztah
    Member

    The deprecated feature used a native Windows daemon to run Linux images. For that, it created a Hyper-V VM for each container it started (effectively Linux containers were implemented as Virtual Machines).
    The code that implemented that was contributed by Microsoft, and was intended to be a POC; the implementation was only partially completed, and the technical design for it had many issues (some of which were known when the implementation started), but was meant to be a temporary implementation with the intent to move the abstraction to lower level runtimes (containerd, and the OCI runtime).

    Some of that work has been done in containerd (see https://github.com/containerd/containerd/pulls?q=is%3Apr+lcow+ for pull requests), but may not yet be completed.

    There was a lot of complication involved, because Windows-native code in the Docker Engine had to (conditionally, depending on the container's image being either Linux or Windows), try to follow Linux semantics using Windows library-code from the Golang runtime (e.g. filepaths to follow Linux semantics/validation instead of Windows).

    Various parts of that complexity also affected other (non-experimental, non-Windows, non-LCOW) codepaths, and the underlying Windows APIs used for the initial PoC were deprecated (and unmaintained) by Microsoft.

    The net-result of all of that was that the LCOW code affected maintainability and stability of the overall code-base, which made us decide to remove it.

    We don't have plans to (try to) implement this using WSL2 (this would be a significant amount of work, and likely involve "implementing containers as WSL2 VMs"), but possibly this (or a comparable) feature could find it's way back through the LCOW implementation in containerd once completed. This may still be a significant amount of work, and as of today has not been budgeted, so I can't give any estimates on that. Work for this would largely need to be done in the upstream "Moby" repository (https://github.com/moby/moby), which is fully open-source, so community participation / contributions are still an option for that.

  20. TBBle commented on May 3, 2023

    @TBBle

    I don't have the API specs in front of me, but if the Docker API had something that could identify the platform of a particular request, e.g., like the --platform flag for old LCOW, then a proxy (such as Docker Desktop, cough) could be used to split such requests between the native Windows dockerd and the WSL2-hosted dockerd. Right now Docker Desktop switches mode to support this same split one at a time, but both daemons are running.

    I also confess I'm not really famliar with Docker Compose, can it be told that different parts of the system run on different dockerd instances, automating some of the ideas earlier in this thread? I'm not sure if it'd be feasible for, e.g., a backend private network shared between a Windows container and a Linux (WSL2-hosted) container, but I'm not sure it wouldn't be doable. (It also might be more complexity than just waiting for "New" LCOW to get into people's hands; my understanding is that it's workable on the containerd side now, but for Docker users it also depends on containerd-on-Windows and also further front-end work to enable it; I also haven't tried it myself, so might be overassuming its current state)

  21. davhdavh commented on May 10, 2023

    @davhdavh

    Why not just start both the windows container mode and wsl2 container mode at the same time?
    Then automatically configure the two in a swarm with some appropriate labels and 99% of the problems goes away.
    Then if i docker run from wsl, it will talk to the linux engine, and if I docker run from powershell it will talk to windows engine, and docker-compose can use the labels (or platform:, or just image) to start on the proper engine.

  22. TBBle commented on May 10, 2023

    @TBBle

    You can do roughly that now, using Docker contexts per #79 (comment) (and see #79 (comment) and the following few comments for caveats and notes). I'm not sure if Docker compose can work across contexts though, or just talks to the current context selected with docker context use.

  23. davhdavh commented on May 12, 2023

    @davhdavh

    Yes, that was kinda my point. It just needs to be the default or a checkbox to enable. That will send a clear signal to other tools to properly support it also

  24. wizpresso-steve-cy-fan commented on Sep 7, 2023

    @wizpresso-steve-cy-fan

    We are also interested to see if LCOW can be upgraded to support WSL2 as a backend.

    The majority of our container applications right now is Windows based, but some of GPU workloads are based on Linux Container.

    We can also confirm that #79 worked to some extent but we don't know how to keep both Windows and Linux Docker daemon running simultaneously without using & $env:ProgramFiles\Docker\docker\DockerCli.exe -SwitchWindowsEngine and & $env:ProgramFiles\Docker\docker\DockerCli.exe -SwitchLinuxEngine

    PS: LCOW support is deprecated but not entirely remove AFAIK, and you can still turn that on with "experiment": true. Obviously however, there doesn't seems to have GPU support unlike WSL2 docker. It seems like it is removed after 23.0.0 which is half a year ago.

  25. TBBle commented on Sep 7, 2023

    @TBBle

    The old LCOW setup is removed from Docker in 23.0, and was already broken in various ways for years before that.

    The new LCOW approach (Sometimes "LCOW v2", but I'm not sure if that's ever been used in a formal sense) is actually the same underlying tech as WSL2 (micro-VMs), but getting it into Docker depends on getting Windows Docker to be based on containerd, which has been a multi-year project already: moby/moby#41455 which I've apparently already referenced here in 2021, and others linked from there. (Also, I've lost track of what outstanding LCOW-specific work is still TBD in containerd itself. I believe it's been working in branches, but I'm not sure if they have all been merged into containerd yet.)

    Once that's done, we will be pretty close (in a tech-stack sense, not in the "rainy afternoon's hacking" sense) to getting what this ticket wants: because containerd doesn't have "Windows" and "LCOW" modes, each container (or sandbox, really) can use a different runtime. Inter-container behaviour between LCOW and Windows containers will probably still have limitations, but being able to build Linux and Windows images in a single Docker daemon without changing modes would only require work in Docker itself, e.g. the UX could be reinstating the old (LCOW) --platform parameter for build and execution commands, but the implementation would be quite different underneath.

    This might also open the door for Compose using a mix of platforms (which I don't think worked with LCOW v1), but I don't know enough about Compose to say anything further on that topic.

  26. linghengqian commented on Jul 22, 2025

    @linghengqian

    That being said, I don't see any issues tracking WSL2 at https://github.com/containerd/containerd/issues . Does this mean that the current issue is actually still blocked by moby/moby#41455 on the moby side?

  27. slonopotamus commented on Jul 22, 2025

    @slonopotamus

    Are there any docs (even basic) on how to use LCOW in containerd? Like, which runtime shim to use, where to get kernel, where to put it, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

community_newdocker_desktop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions