docker-maven-plugin icon indicating copy to clipboard operation
docker-maven-plugin copied to clipboard

Clarify and document case of default `DockerFile` filename.

Open garretwilson opened this issue 1 year ago • 1 comments

I'm using v0.42.0 of the docker-maven-plugin on Windows 10 with Java 17 and Maven 3.8.7. I have a simple Dockerfile named dockerfile in the project root directory which I need to pass arguments to, so I'm using an explicit <image> configuration. I'm following the official documentation for External Dockerfile or Docker archive. The specification for the determination of the Dockerfile is not completely clear in two areas.

It turns out that I can use the following configuration to pick up the dockerfile file:

…
<configuration>
  <images>
    <image>
      <name>…</name>
      <build>
        <contextDir>${project.basedir}</contextDir>
        <args>
          …
        </args>
      </build>
    </image>
  </images>
</configuration>

Notice that I am only specifying the <contextDir>, but not indicating the Dockerfile filename. It appears that the plugin has a reasonable default for finding the Dockerfile (as does docker build itself). This is a good thing! Issue 1: But I cannot find anywhere in the documentation where it indicates that <dockerFile> will look for a default filename if no value is specified. Here's what it says:

dockerFile specifies a specific Dockerfile path. The Docker build context directory is set to contextDir if given. If not the directory by default is the directory in which the Dockerfile is stored.

The second issue has to do with the accepted case of the default Dockerfile filename. It is my understanding that Docker now accepts lowercase dockerfile if PascalCase Dockerfile is not present; see moby/moby#10807 and moby/moby#10858. And in fact the docker-maven-plugin seems to be working with lowercase dockerfile on my system. This is also a good thing!

The problem is that because my Windows 10 system doesn't use case-sensitivity in its file system, I don't know if this is working because the docker-maven-plugin is accepting dockerfile (good) or is only accepting Dockerfile and Windows is oblivious to the distinction (room for improvement). Issue 2: Could you clarify in the documentation if the default Dockerfile filename accepts lowercase dockerfile as well as PascalCase Dockerfile? And if it doesn't, please add support for lowercase dockerfile to bring the plugin in line with Docker itself. (Let me know if I need to file a separate ticket for that.)

Thanks.

garretwilson avatar Mar 07 '23 16:03 garretwilson