testcontainers/testcontainers-java · info

Could not determine Docker OS type

Error message

Could not determine Docker OS type

What it means

After a strategy passed its reachability test, Testcontainers pings the daemon for its OS type (`/info` osType) and got a blank value. It logs this warning and continues, treating the OS as unknown rather than failing. Usually indicates the daemon returned an unexpected or empty info response.

Solutions

  1. Check `docker info` manually and confirm the daemon reports an OSType; upgrade or replace the daemon if not.
  2. If using Podman or an alternative daemon, ensure you run a version that fully implements the Docker Engine API /info payload, or use the podman-compatible socket exposed via podman socket.
  3. Remove/inspect any proxy between the client and daemon that may strip JSON fields.
  4. This is only a warning — the strategy still proceeds; if downstream code fails, pin a standard Docker Engine as the test environment.
Defensive patterns

Strategy: fallback

Validate before calling

// Probe the daemon's info endpoint before the suite
String out = new BufferedReader(new InputStreamReader(
    new URL("http://localhost:2375/info").openStream())).lines()
    .collect(Collectors.joining());
if (!out.contains("ostype") && !out.toLowerCase().contains("ostype")) {
    log.warn("Daemon /info did not report osType; Testcontainers may log 'Could not determine Docker OS type'");
}

Prevention

When it happens

Trigger: strategy.getInfo().getOsType() returns null/empty while running getFirstValidStrategy, i.e. the Docker Engine's info endpoint did not report osType (unusual daemon versions, proxies stripping fields, or non-Docker daemons mimicking the API).

Common situations: Using a non-standard Docker-compatible daemon (Podman, Kaniko-style endpoints, corporate proxies) whose /info omits osType; very old or very new Engine API versions with changed fields; a reverse proxy in front of the socket rewriting responses.

Related errors


AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12). Data as JSON: /api/errors/847d767172662102. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/testcontainers/dockerclient/DockerClientProviderStrategy.java:300

            log.debug("Trying out strategy: {}", strategy.getClass().getSimpleName());

            if (!strategy.test()) {
                log.debug("strategy {} did not pass the test", strategy.getClass().getSimpleName());
                return false;
            }

            strategy.info = strategy.getDockerClient().infoCmd().exec();
            log.info("Found Docker environment with {}", strategy.getDescription());
            log.debug(
                "Transport type: '{}', Docker host: '{}'",
                TestcontainersConfiguration.getInstance().getTransportType(),
                strategy.getTransportConfig().getDockerHost()
            );

            log.debug("Checking Docker OS type for {}", strategy.getDescription());
            String osType = strategy.getInfo().getOsType();
            if (StringUtils.isBlank(osType)) {
                log.warn("Could not determine Docker OS type");
            } else if (!osType.equals("linux")) {
                log.warn("{} is currently not supported", osType);
                throw new InvalidConfigurationException(osType + " containers are currently not supported");
            }

            if (strategy.isPersistable()) {
                TestcontainersConfiguration
                    .getInstance()
                    .updateUserConfig("docker.client.strategy", strategy.getClass().getName());
            }

            return true;
        } catch (Exception | ExceptionInInitializerError | NoClassDefFoundError e) {
            @Nullable
            String throwableMessage = e.getMessage();
            @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
            Throwable rootCause = Throwables.getRootCause(e);
            @Nullable

View on GitHub (pinned to 8e549514e3)