Skip to content

Add support for Windows containers#8436

Draft
gesellix wants to merge 5 commits intotestcontainers:mainfrom
gesellix:wcow
Draft

Add support for Windows containers#8436
gesellix wants to merge 5 commits intotestcontainers:mainfrom
gesellix:wcow

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.

.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

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