{"record":{"id":"d958d4d607acd744","repo":"testcontainers/testcontainers-java","slug":"tried-to-parse-dockerfile-at-path-but-none-was-found","errorCode":null,"errorMessage":"Tried to parse Dockerfile at path {} but none was found","messagePattern":"Tried to parse Dockerfile at path (.+?) but none was found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/src/main/java/org/testcontainers/images/ParsedDockerfile.java","lineNumber":47,"sourceCode":"    private final Path dockerFilePath;\n\n    @Getter\n    private final Set<String> dependencyImageNames;\n\n    public ParsedDockerfile(Path dockerFilePath) {\n        this.dockerFilePath = dockerFilePath;\n        this.dependencyImageNames = parse(read());\n    }\n\n    @VisibleForTesting\n    ParsedDockerfile(List<String> lines) {\n        this.dockerFilePath = Paths.get(\"dummy.Dockerfile\");\n        this.dependencyImageNames = parse(lines);\n    }\n\n    private List<String> read() {\n        if (!Files.exists(dockerFilePath)) {\n            log.warn(\"Tried to parse Dockerfile at path {} but none was found\", dockerFilePath);\n            return Collections.emptyList();\n        }\n\n        try {\n            return Files.readAllLines(dockerFilePath);\n        } catch (IOException e) {\n            log.warn(\"Unable to read Dockerfile at path {}\", dockerFilePath, e);\n            return Collections.emptyList();\n        }\n    }\n\n    private Set<String> parse(List<String> lines) {\n        Set<String> imageNames = lines\n            .stream()\n            .map(FROM_LINE_PATTERN::matcher)\n            .filter(Matcher::matches)\n            .map(matcher -> matcher.group(\"image\"))\n            .collect(Collectors.toSet());","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/core/src/main/java/org/testcontainers/images/ParsedDockerfile.java#L29-L65","documentation":"ParsedDockerfile parses a Dockerfile to find dependent image names (e.g. FROM lines for dependency pre-pulling). If the configured dockerFilePath does not exist, it logs this warning and returns an empty list rather than failing the build. Downstream, the image build may fail because dependencies were not pre-pulled.","triggerScenarios":"read() checks Files.exists(dockerFilePath) inside the ParsedDockerfile constructor path; triggered when ImageFromDockerfile is built from a Dockerfile path that does not exist on disk.","commonSituations":"Typo or wrong relative path passed to withDockerfile / ImageFromDockerfile constructor; Dockerfile excluded from the build artifact; running from a different working directory.","solutions":["Verify the Dockerfile path passed to withDockerfile(...) exists relative to the working directory or classpath","Check build/resource configuration so the Dockerfile is packaged and available at runtime","Pass the Dockerfile content inline via withFileFromString if path-based loading is unreliable"],"exampleFix":"// before\nnew ImageFromDockerfile().withDockerfile(Paths.get(\"Dockefile\"))\n// after (typo fixed and existence checked)\nPath df = Paths.get(\"Dockerfile\");\nif (!Files.exists(df)) throw new IllegalStateException(\"Dockerfile missing: \" + df);\nnew ImageFromDockerfile().withDockerfile(df);","handlingStrategy":"validation","validationCode":"Path dockerfile = Paths.get(\"Dockerfile\");\nif (!Files.exists(dockerfile)) {\n    throw new IllegalStateException(\"Dockerfile not found at \" + dockerfile.toAbsolutePath());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always assert file existence before withDockerfile(...)","Use absolute paths or classpath resources to avoid working-directory surprises","Ensure Dockerfiles are included as test resources in build config"],"tags":["testcontainers","dockerfile","io","missing-file"],"backgroundTag":"file-not-found","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"}