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

Add support for Windows containers #8436

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

gesellix
Copy link
Contributor

Following the release of Ryuk 0.7.0, this adds basic support for Windows containers as a first step for #5621.

The behaviour on Linux and macOS should not be changed in any way, and Windows support depends on the daemon reporting a "windows" operating system.

@gesellix gesellix changed the title Wcow Add support for Windows containers Mar 11, 2024
@gesellix
Copy link
Contributor Author

A WCOW compatible image of https://github.com/testcontainers/helloworld is required for the ResourceReaperTest to succeed on Windows containers.

@@ -31,7 +31,7 @@ class RyukResourceReaper extends ResourceReaper {
.withConstantThroughput()
.build();

private final AtomicBoolean started = new AtomicBoolean(false);
private static final AtomicBoolean started = new AtomicBoolean(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was required to make the ResourceReaperTest succeed. I don't understand, why it fails or why it didn't fail before.

@gesellix
Copy link
Contributor Author

A WCOW compatible image of https://github.com/testcontainers/helloworld is required for the ResourceReaperTest to succeed on Windows containers.

Now as pull request prepared at testcontainers/helloworld#5

@@ -210,6 +212,8 @@ public void close() {
Version version = client.versionCmd().exec();
log.debug("Docker version: {}", version.getRawValues());
activeApiVersion = version.getApiVersion();
String osType = dockerInfo.getOsType();
runningWindowsContainers = StringUtils.isNotBlank(osType) && osType.equals("windows");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really enough to identify WCOW? Meaning with Docker Desktop on Windows with WSL2 backend, it would return linux here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, yes, but I'll check later to ensure we have correct assumptions here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are both variants, using Docker Desktop on Windows 11, WSL2 enabled (not Hyper-V):

λ "c:\Program Files\Docker\Docker\DockerCli.exe" -SwitchLinuxEngine
λ docker info --format "{{json .OSType }}"
"linux"
λ "c:\Program Files\Docker\Docker\DockerCli.exe" -SwitchWindowsEngine
λ docker info --format "{{json .OSType }}"
"windows"

…'t work on Windows, yet.

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

Successfully merging this pull request may close these issues.

2 participants