Repository navigation
Add a pool option that selects the runner network - #22
Merged
Merged
Conversation
Docker socket pools always used the host network. On Docker Desktop 4.95.0 (WSL2 backend) a JVM there cannot connect to 127.0.0.1 in the same runner, and JAVA_TOOL_OPTIONS=-Djava.net.preferIPv4Stack=true (#20) only helps part of a build: Gradle starts worker daemons, which ktlint uses, without the build's environment, so they still fail to reach the daemon. network = "host" | "bridge" (or pool add --network) now picks the network for a pool's runner containers. Unset keeps the previous behavior: host for Docker socket pools, Docker's default bridge otherwise. Only a change of the effective network starts a new runner generation, so writing out the default does not replace runners. docs/platforms.md now recommends a bridge pool with TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal for JVM builds on Docker Desktop, replacing the JAVA_TOOL_OPTIONS advice. tests/docker-socket.sh takes RUNNER_NETWORK to check a bridge pool. Verification: cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings, cargo test --locked, tests/entrypoint.sh, tests/docker-socket.sh with host and bridge, cargo test --locked docker_ -- --ignored. On the same Docker Desktop, a Gradle build with ktlint workers, Kotlin compilation and a Testcontainers MariaDB test passed in a bridge container with the socket mounted and the override set.
Merged
clroot
added a commit
that referenced
this pull request
Nov 9, 2026
Adds two pool options: env (#20) passes environment variables to a pool's runner containers and their jobs, and network (#22) runs a Docker socket pool on Docker's bridge network instead of the host network. Together they let JVM builds with Testcontainers run on Docker Desktop, where a host-network runner cannot reach 127.0.0.1 from Java.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#20 added
JAVA_TOOL_OPTIONS=-Djava.net.preferIPv4Stack=trueas the fix for JVM builds on Docker Desktop host-network runners. Gradle's worker daemons do not inherit the build's environment variables, so it is not enough. ktlint, for example, runs in those workers. A quality job in another repository still failed onrunKtlintCheckOverKotlinScripts:Could not connect to server [... addresses:[/127.0.0.1]],Connection refused.To check which processes got the variable, a JVM log option was added to it. With it set, the Gradle client and daemon got it, but the four worker daemons did not.
Change
network = "host" | "bridge", orpool add --network host|bridge.docker_socketpools, Docker's default bridge otherwise.docs/platforms.md: the Docker Desktop JVM section now recommends a bridge pool withTESTCONTAINERS_HOST_OVERRIDE=host.docker.internal. This replaces the incorrectJAVA_TOOL_OPTIONSadvice.docs/operations.md,config.example.toml: document the option and what bridge pools give up:services:throughlocalhost.tests/docker-socket.sh:RUNNER_NETWORK=bridgechecks a bridge pool.Verification
On Docker Desktop 4.95.0 (WSL2), with the Docker socket mounted:
JAVA_TOOL_OPTIONS,TESTCONTAINERS_HOST_OVERRIDE=127.0.0.1Ryuk at 172.17.0.1)TESTCONTAINERS_HOST_OVERRIDE=host.docker.internalcargo fmt --check,cargo clippy --all-targets --locked -- -D warnings,cargo test --locked: pass. Adds 3 tests: config defaults and roundtrip, container args, runner generation.tests/entrypoint.sh,tests/docker-socket.sh(host andRUNNER_NETWORK=bridge),cargo test --locked docker_ -- --ignored: pass.🤖 Generated with Claude Code