{"record":{"id":"7b19123713473448","repo":"testcontainers/testcontainers-java","slug":"could-not-find-a-default-docker-machine-instance","errorCode":null,"errorMessage":"Could not find a default docker-machine instance","messagePattern":"Could not find a default docker-machine instance","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/testcontainers/containers/GenericContainer.java","lineNumber":1322,"sourceCode":"    public String getDockerImageName() {\n        try {\n            return image.get();\n        } catch (Exception e) {\n            throw new ContainerFetchException(\"Can't get Docker image: \" + image, e);\n        }\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    @Deprecated\n    public String getTestHostIpAddress() {\n        if (DockerMachineClient.instance().isInstalled()) {\n            try {\n                Optional<String> defaultMachine = DockerMachineClient.instance().getDefaultMachine();\n                if (!defaultMachine.isPresent()) {\n                    throw new IllegalStateException(\"Could not find a default docker-machine instance\");\n                }\n\n                String sshConnectionString = CommandLine\n                    .runShellCommand(\"docker-machine\", \"ssh\", defaultMachine.get(), \"echo $SSH_CONNECTION\")\n                    .trim();\n                if (Strings.isNullOrEmpty(sshConnectionString)) {\n                    throw new IllegalStateException(\n                        \"Could not obtain SSH_CONNECTION environment variable for docker machine \" +\n                        defaultMachine.get()\n                    );\n                }\n\n                String[] sshConnectionParts = sshConnectionString.split(\"\\\\s\");\n                if (sshConnectionParts.length != 4) {\n                    throw new IllegalStateException(\n                        \"Unexpected pattern for SSH_CONNECTION for docker machine - expected 'IP PORT IP PORT' pattern but found '\" +\n                        sshConnectionString +\n                        \"'\"","sourceCodeStart":1304,"sourceCodeEnd":1340,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/core/src/main/java/org/testcontainers/containers/GenericContainer.java#L1304-L1340","documentation":"Thrown by the deprecated getTestHostIpAddress: docker-machine is installed, but querying it returns no default machine (empty Optional), so Testcontainers cannot determine the host IP and raises an IllegalStateException. The missing input is a default docker-machine instance.","triggerScenarios":"Thrown at core/src/main/java/org/testcontainers/containers/GenericContainer.java:1322 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create or start a docker-machine default instance (docker-machine create/start default)","Run against a locally installed Docker daemon instead of docker-machine","Avoid the deprecated getTestHostIpAddress and use container networking"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}