quarkusio/quarkus · error · IllegalArgumentException

Specified Dockerfile path %s does not exist

Error message

Specified Dockerfile path %s does not exist

What it means

ProvidedDockerfile.get() validates the Dockerfile configured via quarkus.container-image.docker.dockerfile-jvm-path (or -native-path). Relative paths are resolved against the main sources root; if the resolved (or absolute) path does not exist on disk, it throws this IllegalArgumentException with the absolute path in the message.

Source

Thrown at extensions/container-image/container-image-docker-common/deployment/src/main/java/io/quarkus/container/image/docker/common/deployment/CommonProcessor.java:432

            }

            return new AbstractMap.SimpleEntry<>(dockerfilesRoot, mainSourcesRoot.getValue());
        }
    }

    protected record ProvidedDockerfile(Path dockerfilePath, Path dockerExecutionPath) implements DockerfilePaths {
        protected static DockerfilePaths get(Path dockerfilePath, Path outputDirectory) {
            var mainSourcesRoot = findMainSourcesRoot(outputDirectory);

            if (mainSourcesRoot == null) {
                throw new IllegalStateException("Unable to determine project root");
            }

            var executionPath = mainSourcesRoot.getValue();
            var effectiveDockerfilePath = dockerfilePath.isAbsolute() ? dockerfilePath : executionPath.resolve(dockerfilePath);

            if (!effectiveDockerfilePath.toFile().exists()) {
                throw new IllegalArgumentException(
                        "Specified Dockerfile path %s does not exist".formatted(effectiveDockerfilePath.toAbsolutePath()));
            }

            return new ProvidedDockerfile(effectiveDockerfilePath, executionPath);
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Fix the configured path: relative values are resolved from src/main, so use 'docker/Dockerfile' not 'src/main/docker/Dockerfile'
  2. Verify the file exists at the absolute path printed in the error message
  3. Use an absolute path in CI if the file lives outside the project
  4. Correct typos/case-sensitivity in the filename

Example fix

# before (wrong base dir)
quarkus.container-image.docker.dockerfile-jvm-path=src/main/docker/Dockerfile.custom
# after
quarkus.container-image.docker.dockerfile-jvm-path=docker/Dockerfile.custom
Defensive patterns

Strategy: validation

Validate before calling

String configured = "src/main/docker/Dockerfile.custom"; // value of dockerfile-jvm-path
Path srcMain = Path.of("src/main");
Path effective = Paths.get(configured).isAbsolute() ? Paths.get(configured) : srcMain.resolve(configured);
if (!Files.isRegularFile(effective)) {
    throw new IllegalStateException("Configured Dockerfile not found at " + effective.toAbsolutePath());
}

Type guard

boolean configuredDockerfileExists(String path, Path sourcesRoot) {
    Path p = Paths.get(path);
    return (p.isAbsolute() ? p : sourcesRoot.resolve(p)).toFile().exists();
}

Try / catch

try {
    buildImage();
} catch (IllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().contains("Specified Dockerfile path")) {
        // correct quarkus.container-image.docker.dockerfile-jvm-path and retry
    } else throw e;
}

Prevention

When it happens

Trigger: Setting quarkus.container-image.docker.dockerfile-jvm-path / dockerfile-native-path to a file that does not exist, a relative path that resolves to the wrong directory (it is relative to src/main, not the project root), or a typo in the filename.

Common situations: Assuming the path is relative to the project root when it is relative to src/main (so 'docker/Dockerfile' works but 'src/main/docker/Dockerfile' fails); renaming the file but not the config; absolute path pointing to a machine-specific location that is absent in CI.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/63926ac2d65bcb5d. Report an issue: GitHub.