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

support Linux containers when running on Windows VMs #3548

Open
jtnord opened this issue Apr 26, 2023 · 3 comments
Open

support Linux containers when running on Windows VMs #3548

jtnord opened this issue Apr 26, 2023 · 3 comments

Comments

@jtnord
Copy link

jtnord commented Apr 26, 2023

Service(s)

ci.jenkins.io

Summary

It is not uncommon for a plugin to have some containers for tests and use the legacy docker-fixtures or TestContainers

However the containers are generally linux specific (e.g. --platform=linux) and this causes build errors when run on windows VMs.

As it is useful to run the tests on Windows as well as Linux it would be helpful if there was a Windows VM that had been set to Linux containers (rather than the current Linux containers).

Current workaround is to use a specific container label in the buildPlugins (which actually broke and was just fixed a few hours ago)

e.g. https://github.com/jenkinsci/distfork-plugin/blob/master/Jenkinsfile https://github.com/jenkinsci/docker-workflow-plugin/blob/d5d2e5c4007f7ea006152542b2bcbe0f1b2b08aa/Jenkinsfile#L1-L4 are 2 plugins that use this approach.

a windows VM can be switched between linux and windows containers with the command "c:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon

untested (the help is broken) but -SwitchLinuxEngine may switch specifically to linux and -SwitchWindowsEngine may likewise do the same for windows containers.

Reproduction steps

No response

@dduportal
Copy link
Contributor

Alas the flags -SwitchDaemon (etc.) are Docker Desktop only si it's not an option today on the Jenkins Infrastrcuture which uses Windows Server VMs.

As per https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment, Docker Desktop is recommended on Windows 10/11 and Docker CE standalone (or Mirantis or containerd) on Windows Server 2016/2019/2022.

It means that, in order to cover the CI case of "Windows build with Linux container", we need to use one of the following solutions:

  • Define a new kind of VM with a Windows 11 + Docker Desktop to replace existing Windows images

    • ✅ Allows user jenkins switching from/to Linux Container
    • ✅ Closer environment to contributors
    • ❌ Slower Windows container (due to Hyper V isolation instead of native container isolation used on Windows Server)
    • ❌ Need to keep maintaining Windows containers images for usage in ACI/Kubernetes that must be Windows Server
  • Define a new kind of VM with a Windows 11 + Docker Desktop to next to existing Windows images

    • ✅ Allows user jenkins switching from/to Linux Container
    • ✅ Closer environment to contributors
    • ❌ Need to keep maintaining 3 kinds of Windows templates
    • ❌ Need to add a whole new set of labels on ci.jenkins.io
  • (if it works: nested virtualization is to be checked) Define a new kind of VM with a Windows Server + WSL (to provide Docker containers) next to existing Windows images

    • ✅ Provides a Linux container in Windows environment as expected
    • ✅ Easier to maintain as it would be a minor variation of the existing templates
    • ❌ Suffers from the hiccups of WSL (bind mounts particularly that can act weirdly) and nested virtualization slowness
    • ❌ Need to keep maintaining 3 kinds of Windows templates
    • ❌ Need to add a whole new set of labels on ci.jenkins.io

if you have any other idea, please share!

@dduportal dduportal removed the triage Incoming issues that need review label May 2, 2023
@dduportal dduportal added this to the infra-team-sync-next milestone May 2, 2023
@dduportal
Copy link
Contributor

Tried a manual installation of Docker Desktop on a Windows 2022 (full, not a "core") server: succeeded with the UI enabled but I failed to have Docker Linux containers working.

Gotta try with WSL preinstalled and initialized before Docker Desktop.

going to backlog as no emergency here

@dduportal
Copy link
Contributor

Another plugin might have this use case: jenkinsci/docker-workflow-plugin#331

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

No branches or pull requests

2 participants