quarkusio/quarkus · error · IllegalArgumentException

Specified Dockerfile: '%s' is not a normal file.

Error message

Specified Dockerfile: '%s' is not a normal file.

What it means

The same validate() method also requires the Dockerfile path to be a regular file (File.isFile()). Directories, special files (sockets, devices) and other non-regular entries are rejected with IllegalArgumentException("Specified Dockerfile: '<path>' is not a normal file.").

Source

Thrown at extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/ApplyDockerfileToBuildConfigDecorator.java:35

public class ApplyDockerfileToBuildConfigDecorator extends NamedResourceDecorator<BuildConfigSpecFluent<?>> {

    private final Path pathToDockerfile;

    public ApplyDockerfileToBuildConfigDecorator(String name, Path pathToDockerfile) {
        super(name);
        validate(pathToDockerfile);
        this.pathToDockerfile = pathToDockerfile;
    }

    private void validate(Path pathToDockerfile) {
        File file = pathToDockerfile.toFile();
        if (!file.exists()) {
            throw new IllegalArgumentException(
                    "Specified Dockerfile: '" + pathToDockerfile.toAbsolutePath().toString() + "' does not exist.");
        }
        if (!file.isFile()) {
            throw new IllegalArgumentException(
                    "Specified Dockerfile: '" + pathToDockerfile.toAbsolutePath().toString() + "' is not a normal file.");
        }

        try {
            Stream<String> lines = Files.lines(pathToDockerfile);
            Optional<String> fromLine = lines.filter(l -> !l.startsWith("#")).map(String::trim)
                    .filter(l -> l.startsWith("FROM")).findFirst();
            if (!fromLine.isPresent()) {
                throw new IllegalArgumentException("Specified Dockerfile: '" + pathToDockerfile.toAbsolutePath().toString()
                        + "' does not contain a FROM directive");
            }
        } catch (IOException e) {
            throw new IllegalArgumentException(
                    "Unable to validate specified Dockerfile: '" + pathToDockerfile.toAbsolutePath().toString() + "'");
        }
    }

    @Override

View on GitHub (pinned to e1c734241f)

Solutions

  1. Point quarkus.openshift.dockerfile at the Dockerfile file itself, not its parent directory
  2. Verify with ls -l that the target is a regular file (-)
  3. If using a symlink, confirm it resolves to a regular file

Example fix

// before
quarkus.openshift.dockerfile=src/main/docker
// after
quarkus.openshift.dockerfile=src/main/docker/Dockerfile
Defensive patterns

Strategy: validation

Validate before calling

java.nio.file.Path df = java.nio.file.Path.of(dockerfileConfig);
if (java.nio.file.Files.isDirectory(df)) {
    throw new IllegalStateException("quarkus.openshift.dockerfile must point to the file, not a directory: " + df);
}

Prevention

When it happens

Trigger: quarkus.openshift.dockerfile points at a directory (e.g. the docker/ directory itself) or a special/non-regular filesystem entry instead of the Dockerfile file.

Common situations: Pointing the config at src/main/docker (directory) instead of src/main/docker/Dockerfile; multi-stage setups where the config value was copied from a directory property; symlink loops resolving to non-regular files.

Related errors


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