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

Simple mode docker.tags property is ignored

Open blsouthr opened this issue 4 years ago • 8 comments

Description

docker.tags are ignored in simple mode

Info

  • d-m-p version : 0.33.0
  • Maven version (mvn -v) : 3.6.3

  • Docker version : Docker version 18.09.3, build 774a1f4eee
  • Reproduce : add additional tag with -Ddocker.tags.idx=foo

I've overriden default name with tag A, but I need an additional tag B, which is ignored:

<properties>
    <docker.name>${project.artifactId}:${project.version}</docker.name>
    <docker.tags.0>foo</docker.tags.0>
</properties>

blsouthr avatar Mar 27 '20 10:03 blsouthr

Could you provide a full running example please ?

rhuss avatar Jun 04 '20 09:06 rhuss

Using plugin version 0.33.0 with maven 3.6.0. Tried both openjdk8 and jdk11 (adopt/hotspot).

I couldn't make the docker.tags.0 property work in any possible way...

  • I tried with maven profiles (because we already had them).
  • Then I removed them in case that was the issue, didn't work.
  • I tried adding the property inside pom.xml while keeping/ditching the normal <tags> inside the plugin config, neither worked.
  • I tried without the property inside pom.xml, but by providing it from command like -Ddocker.tags.0=foo, again while keeping/ditching the normal <tags> inside the plugin config, neither worked again.

From where I'm standing, this feature simply does not exist...

Kidlike avatar Jul 03 '20 16:07 Kidlike

I'm also seeing this with 0.34.1.

manderson23 avatar Mar 05 '21 15:03 manderson23

@manderson23 : Hello, Would it be possible for you to share a reproducer project?

rohanKanojia avatar Mar 05 '21 15:03 rohanKanojia

The following pom.xml reproduces when running mvn -Ddocker.tags.0=latest package

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.4.3</version>
    <relativePath/> <!-- lookup parent from repository -->
  </parent>
  <groupId>com.example</groupId>
  <artifactId>demo</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>demo</name>
  <description>Demo project for Spring Boot</description>
  <properties>
    <java.version>11</java.version>

    <docker.image.prefix>prefix</docker.image.prefix>
    <docker.registry>host:5000</docker.registry>
    <docker.tag>${project.version}</docker.tag>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.34.1</version>
        <configuration>
          <images>
            <image>
              <!-- Use project version in image name as we always push that -->
              <name>${docker.registry}/${docker.image.prefix}/${project.artifactId}:${docker.tag}</name>
              <build>
                <dockerFile>${project.basedir}/Dockerfile</dockerFile>
                <args>
                  <JAR_FILE>target/${project.build.finalName}.${project.packaging}</JAR_FILE>
                </args>
                <noCache>true</noCache>
              </build>
            </image>
          </images>
        </configuration>
        <executions>
          <execution>
            <id>build</id>
            <phase>package</phase>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
          <execution>
            <id>push</id>
            <phase>deploy</phase>
            <goals>
              <goal>push</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>

manderson23 avatar Mar 08 '21 08:03 manderson23

@manderson23 : cool, thanks a lot. I'll try to reproduce

rohanKanojia avatar Mar 08 '21 08:03 rohanKanojia

Using plugin version 0.33.0 with maven 3.6.0. Tried both openjdk8 and jdk11 (adopt/hotspot).

I couldn't make the docker.tags.0 property work in any possible way...

  • I tried with maven profiles (because we already had them).
  • Then I removed them in case that was the issue, didn't work.
  • I tried adding the property inside pom.xml while keeping/ditching the normal <tags> inside the plugin config, neither worked.
  • I tried without the property inside pom.xml, but by providing it from command like -Ddocker.tags.0=foo, again while keeping/ditching the normal <tags> inside the plugin config, neither worked again.

From where I'm standing, this feature simply does not exist...

I wonder if setting -Ddocker.imagePropertyConfiguration=override does the trick ...

ls-urs-keller avatar Nov 24 '21 23:11 ls-urs-keller

It works with -Ddocker.imagePropertyConfiguration=override

attiand avatar May 03 '23 11:05 attiand