Code Monkey home page Code Monkey logo

Comments (8)

rohanKanojia avatar rohanKanojia commented on June 8, 2024

@davidmichaelkarr : You should be able to see fully qualified image name when you do a docker:build, this is logged when in normal build without verbose options enabled:

mvn docker:build

 docker:0.45-SNAPSHOT:build (default-cli) @ dmp-build-arg-regression ---
[INFO] Building tar: /home/rokumar/work/repos/dmp-testing/dmp-build-arg-regression/target/docker/myimage/21/tmp/docker-build.tar
[INFO] DOCKER> [myimage:21]: Created docker-build.tar in 33 milliseconds
[INFO] DOCKER> [myimage:21]: Built image sha256:07911
[INFO] ------------------------------------------------------------------------

In above case image name is myimage:21 where tag is 21.

If you specify build in verbose option, you will be able to see docker build output:

$ mvn docker:build -Ddocker.verbose=build

[INFO] --- docker:0.45-SNAPSHOT:build (default-cli) @ dmp-build-arg-regression ---
[INFO] Building tar: /home/rokumar/work/repos/dmp-testing/dmp-build-arg-regression/target/docker/myimage/21/tmp/docker-build.tar
[INFO] DOCKER> [myimage:21]: Created docker-build.tar in 33 milliseconds
[INFO] DOCKER> Step 1/2 : ARG FROM_IMAGE
[INFO] DOCKER> 
[INFO] DOCKER> Step 2/2 : FROM ${FROM_IMAGE} AS jlink
[INFO] DOCKER> 
[INFO] DOCKER> ---> 079114de2be1
[INFO] DOCKER> Successfully built 079114de2be1
[INFO] DOCKER> Successfully tagged myimage:21
[INFO] DOCKER> [myimage:21]: Built image sha256:07911
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.398 s
[INFO] Finished at: 2024-02-27T11:05:53+05:30
[INFO] ------------------------------------------------------------------------

If you specify api in verbose option, you will be able to see Docker API endpoints being hit:

$ mvn docker:build -Ddocker.verbose=api

[INFO] --- docker:0.45-SNAPSHOT:build (default-cli) @ dmp-build-arg-regression ---
[INFO] DOCKER> GET unix://127.0.0.1:1/version
[INFO] Building tar: /home/rokumar/work/repos/dmp-testing/dmp-build-arg-regression/target/docker/myimage/21/tmp/docker-build.tar
[INFO] DOCKER> [myimage:21]: Created docker-build.tar in 32 milliseconds
[INFO] DOCKER> GET unix://127.0.0.1:1/v1.44/images/openjdk%3A21/json
[INFO] DOCKER> GET unix://127.0.0.1:1/v1.44/images/openjdk%3A21/json
[INFO] DOCKER> GET unix://127.0.0.1:1/v1.44/images/openjdk%3A21/json
[INFO] DOCKER> GET unix://127.0.0.1:1/v1.44/images/myimage%3A21/json
[INFO] DOCKER> POST to unix://127.0.0.1:1/v1.44/build?buildargs=%7B%22FROM_IMAGE%22%3A%22openjdk%3A21%22%7D&dockerfile=Dockerfile&forcerm=1&nocache=0&squash=0&t=myimage%3A21 with contents of file /home/rokumar/work/repos/dmp-testing/dmp-build-arg-regression/target/docker/myimage/21/tmp/docker-build.tar
[INFO] DOCKER> GET unix://127.0.0.1:1/v1.44/images/myimage%3A21/json
[INFO] DOCKER> [myimage:21]: Built image sha256:07911
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

from docker-maven-plugin.

davidmichaelkarr avatar davidmichaelkarr commented on June 8, 2024

I'm getting nothing from all those variations. I think this must mean that the plugin is finding nothing to do. I don't know why that would be, but I would have to guess that it's not seeing a Dockerfile. Would the plugin print no output if that happened? We'll look closely at the config later today.

from docker-maven-plugin.

rohanKanojia avatar rohanKanojia commented on June 8, 2024

@davidmichaelkarr : I'm not able to see any image configuration in your plugin configuration. Could you please try adding this in plugin configuration?

        <images>
          <image>
            <name>your-registry.org/yourusername/yourimagename:tag</name>
            <build>
              <dockerFile>Dockerfile</dockerFile>
            </build>
          </image>
        </images>

By default plugin would automatically detect Dockerfile if it is placed in project root directory.

Could you please check our dockerfile sample project to see how it's different from your project?

from docker-maven-plugin.

davidmichaelkarr avatar davidmichaelkarr commented on June 8, 2024

OK. Would this look better (untested)?

<images>
  <image>
    <name>imagenamewithtag</name>
    <build>
      <contextDir>${project.basedir}/src/main/docker</contextDir>
    </build>
  </image>
</images>

from docker-maven-plugin.

rohanKanojia avatar rohanKanojia commented on June 8, 2024

It should work given your Dockerfile has correct references as per your configured docker context directory.

from docker-maven-plugin.

davidmichaelkarr avatar davidmichaelkarr commented on June 8, 2024

It looks like the name can't have the tag, so we're adding a tags block.

from docker-maven-plugin.

rohanKanojia avatar rohanKanojia commented on June 8, 2024

default tag is added after : in the image <name> block, something like this:

<name>yourimagename:yourtag</name>

from docker-maven-plugin.

davidmichaelkarr avatar davidmichaelkarr commented on June 8, 2024

Well, we we were trying to have "yourtag" reference a property, like "${docker.image.tag}". That gets a syntax error. Fortunately, we are were able to do this with a tags block.

from docker-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.