{"record":{"id":"a65a4aa3d5c3dca2","repo":"quarkusio/quarkus","slug":"unable-to-find-dockerfile-s-in-s","errorCode":null,"errorMessage":"Unable to find Dockerfile %s in %s","messagePattern":"Unable to find Dockerfile (.+?) in (.+?)","errorType":"console","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/container-image/container-image-docker-common/deployment/src/main/java/io/quarkus/container/image/docker/common/deployment/CommonProcessor.java","lineNumber":397,"sourceCode":"    }\n\n    protected interface DockerfilePaths {\n        Path dockerfilePath();\n\n        Path dockerExecutionPath();\n    }\n\n    protected record DockerfileDetectionResult(Path dockerfilePath, Path dockerExecutionPath) implements DockerfilePaths {\n        protected static DockerfilePaths detect(String resource, Path outputDirectory) {\n            var dockerfileToExecutionRoot = findDockerfileRoot(outputDirectory);\n            if (dockerfileToExecutionRoot == null) {\n                throw new IllegalStateException(\n                        \"Unable to find root of Dockerfile files. Consider adding 'src/main/docker/' to your project root.\");\n            }\n\n            var dockerFilePath = dockerfileToExecutionRoot.getKey().resolve(resource);\n            if (!Files.exists(dockerFilePath)) {\n                throw new IllegalStateException(\n                        \"Unable to find Dockerfile %s in %s\"\n                                .formatted(resource, dockerfileToExecutionRoot.getKey().toAbsolutePath()));\n            }\n\n            return new DockerfileDetectionResult(dockerFilePath, dockerfileToExecutionRoot.getValue());\n        }\n\n        private static Map.Entry<Path, Path> findDockerfileRoot(Path outputDirectory) {\n            var mainSourcesRoot = findMainSourcesRoot(outputDirectory);\n            if (mainSourcesRoot == null) {\n                return null;\n            }\n\n            var dockerfilesRoot = mainSourcesRoot.getKey().resolve(DOCKER_DIRECTORY_NAME);\n            if (!dockerfilesRoot.toFile().exists()) {\n                return null;\n            }\n","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/container-image/container-image-docker-common/deployment/src/main/java/io/quarkus/container/image/docker/common/deployment/CommonProcessor.java#L379-L415","documentation":"The default-Dockerfile detection found the docker directory root but the specific expected Dockerfile resource (e.g. Dockerfile.jvm, Dockerfile.legacy-jar, Dockerfile.native) does not exist in it, so detect() throws this IllegalStateException naming the missing file and the absolute root path.","triggerScenarios":"src/main/docker/ exists but is missing the Dockerfile matching the package type: Dockerfile.legacy-jar needed when quarkus.package.jar.type=legacy-jar, or Dockerfile.native needed for a native image build, etc.","commonSituations":"Switching quarkus.package.jar.type to legacy-jar while only Dockerfile.jvm exists; users deleting Dockerfile.native as 'unused'; typos renaming the file (Dockerfile.jvm.txt).","solutions":["Restore the missing Dockerfile into src/main/docker/ from a generated Quarkus project","Set quarkus.container-image.docker.dockerfile-jvm-path (or -native-path) to point at the Dockerfile you actually have","Match the package type configuration (quarkus.package.jar.type) with the Dockerfiles present","Check the absolute path in the message to confirm which directory and filename are expected"],"exampleFix":"# before: only Dockerfile.jvm present, legacy-jar build\n./mvnw package -Dquarkus.package.jar.type=legacy-jar -Dquarkus.container-image.build=true\n# after\ncp Dockerfile.jvm Dockerfile.legacy-jar  # or set quarkus.container-image.docker.dockerfile-jvm-path=Dockerfile.jvm","handlingStrategy":"validation","validationCode":"String pkgType = System.getProperty(\"quarkus.package.jar.type\", \"fast-jar\");\nString expected = pkgType.equals(\"legacy-jar\") ? \"Dockerfile.legacy-jar\"\n        : \"Dockerfile.jvm\";\nif (!Files.isRegularFile(Path.of(\"src/main/docker\", expected))) {\n    throw new IllegalStateException(\"Missing \" + expected + \" in src/main/docker\");\n}","typeGuard":"boolean dockerfileExistsFor(String name) {\n    return Files.isRegularFile(Path.of(\"src/main/docker\", name));\n}","tryCatchPattern":"try {\n    buildImage();\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Unable to find Dockerfile\")) {\n        // restore file or set quarkus.container-image.docker.dockerfile-jvm-path\n    } else throw e;\n}","preventionTips":["Keep all generated Dockerfiles (jvm, legacy-jar, native, native-micro) in src/main/docker","When setting quarkus.package.jar.type=legacy-jar, ensure Dockerfile.legacy-jar exists","Point dockerfile-jvm-path at an existing Dockerfile if you maintain your own","Verify filenames have no stray extensions (.txt) or case mismatches"],"tags":["docker","dockerfile","missing-file","packaging"],"backgroundTag":"dockerfile-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}