{"record":{"id":"1d22ad5f161242a7","repo":"testcontainers/testcontainers-java","slug":"containerised-docker-compose-exited-abnormally-with-code","errorCode":null,"errorMessage":"Containerised Docker Compose exited abnormally with code ${exitCode} whilst running command: ${commandParts}","messagePattern":"Containerised Docker Compose exited abnormally with code (.+?) whilst running command: (.+?)","errorType":"exception","errorClass":"ContainerLaunchException","httpStatus":null,"severity":"critical","filePath":"core/src/main/java/org/testcontainers/containers/ContainerisedDockerCompose.java","lineNumber":104,"sourceCode":"        followOutput(new Slf4jLogConsumer(logger()));\n\n        // wait for the compose container to stop, which should only happen after it has spawned all the service containers\n        logger().info(\"Docker Compose container is running for command: {}\", Joiner.on(\" \").join(getCommandParts()));\n        while (isRunning()) {\n            logger().trace(\"Compose container is still running\");\n            Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);\n        }\n\n        AuditLogger.doComposeLog(getCommandParts(), getEnv());\n\n        final Integer exitCode = getDockerClient()\n            .inspectContainerCmd(getContainerId())\n            .exec()\n            .getState()\n            .getExitCode();\n\n        if (exitCode == null || exitCode != 0) {\n            throw new ContainerLaunchException(\n                \"Containerised Docker Compose exited abnormally with code \" +\n                exitCode +\n                \" whilst running command: \" +\n                StringUtils.join(getCommandParts(), ' ')\n            );\n        }\n\n        logger().info(\"Docker Compose has finished running\");\n    }\n\n    private String convertToUnixFilesystemPath(String path) {\n        return SystemUtils.IS_OS_WINDOWS ? PathUtils.createMinGWPath(path).substring(1) : path;\n    }\n}\n","sourceCodeStart":86,"sourceCodeEnd":119,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/core/src/main/java/org/testcontainers/containers/ContainerisedDockerCompose.java#L86-L119","documentation":"ContainerisedDockerCompose runs docker-compose inside a helper container. After invoking the compose command it inspects the exit code; if it is null or nonzero it wraps the failure in ContainerLaunchException stating the abnormal exit code and command parts.","triggerScenarios":"Any compose command failure: invalid docker-compose.yml, missing image/service build failure, compose file referencing nonexistent paths/images, port conflicts, or out-of-memory inside the compose container.","commonSituations":"Syntax errors or unsupported version key in docker-compose.yml; missing .env variables; images that fail to pull in restricted networks; build context paths not visible to the compose container.","solutions":["Read the full stack's preceding container logs to see the underlying compose error output","Validate docker-compose.yml (e.g. docker compose config) and fix syntax/version issues","Ensure referenced images/build contexts/env files are reachable and correct","Run with ContainerisedDockerCompose/Project DockerComposeContainer debug logging (org.testcontainers DEBUG) to inspect the compose command output"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"Process p = new ProcessBuilder(\"docker\", \"compose\", \"-f\", composeFile.toString(), \"config\", \"--quiet\"); if (p.inheritIO().start().waitFor() != 0) throw new IllegalStateException(\"Invalid compose file: \" + composeFile);","typeGuard":null,"tryCatchPattern":"try { compose.start(); } catch (ContainerLaunchException e) { log.error(\"docker-compose failed ({}). Check compose logs above for the real error.\", e.getMessage()); throw e; }","preventionTips":["Validate the compose file with 'docker compose config' in CI before tests","Keep images/build contexts available to the daemon","Enable org.testcontainers DEBUG logging to capture compose stdout/stderr"],"tags":["docker-compose","process-exit","container-launch","compose"],"backgroundTag":"http-error-response","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}