Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple mode docker.tags property is ignored #1332

Open
blsouthr opened this issue Mar 27, 2020 · 8 comments
Open

Simple mode docker.tags property is ignored #1332

blsouthr opened this issue Mar 27, 2020 · 8 comments
Assignees

Comments

@blsouthr
Copy link

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>
@rhuss
Copy link
Collaborator

rhuss commented Jun 4, 2020

Could you provide a full running example please ?

@Kidlike
Copy link

Kidlike commented Jul 3, 2020

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...

@manderson23
Copy link

I'm also seeing this with 0.34.1.

@rohanKanojia
Copy link
Member

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

@manderson23
Copy link

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>

@rohanKanojia rohanKanojia self-assigned this Mar 8, 2021
@rohanKanojia
Copy link
Member

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

@ls-urs-keller
Copy link

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 ...

@attiand
Copy link

attiand commented May 3, 2023

It works with -Ddocker.imagePropertyConfiguration=override

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants