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

Labels are not set #543

Open
jakub-bochenski opened this issue Aug 23, 2016 · 9 comments
Open

Labels are not set #543

jakub-bochenski opened this issue Aug 23, 2016 · 9 comments

Comments

@jakub-bochenski
Copy link
Contributor

Plugin version: 0.15.16
Docker version: 1.11.2

According to Maven debug output the labels property is set:

[DEBUG]   (f) labels = {Built-By=jbochenski, Built-On=08/23/2016 12:35:35, Maven-Artifact=com.acme.cloudapp:acme-main:1.5.0-SNAPSHOT, Source-Branch=develop, Source-Revision=0d6bef176407ce2af4b83bb9b1f79dd7d8d98be3}

but after the image is built I only see the lables from base centos:centos7 image:

"Labels":{"build-date":"2016-06-02","license":"GPLv2","name":"CentOS Base Image","vendor":"CentOS"}}
@jakub-bochenski
Copy link
Contributor Author

Here is the build output (minus binary data): https://gist.github.com/jakub-bochenski/f51d2fb64d871ba578b94732ec1c10d0

@rhuss
Copy link
Collaborator

rhuss commented Aug 23, 2016

Sorry, I'm just on my way to holidays. Will have a look mid next week ...

jakub-bochenski notifications@github.com schrieb am Di., 23. Aug. 2016,
16:27:

Here is the build output (minus binary data):
https://gist.github.com/jakub-bochenski/f51d2fb64d871ba578b94732ec1c10d0


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#543 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAGDCCFJSOXgACFASs3XXtlxgVYD5T31ks5qiwNXgaJpZM4Jq46V
.

@jakub-bochenski
Copy link
Contributor Author

bump

@rhuss
Copy link
Collaborator

rhuss commented Sep 1, 2016

Could you please post the relevant configuration of the plugin ? I.e. where the <labels> are set (remember, they need to be in a <build> section within an <image>)

@jakub-bochenski
Copy link
Contributor Author

Here is the relevant part of mvn help:effective-pom output:

     <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.15.16</version>
        <executions>
          <execution>
            <id>docker</id>
            <phase>install</phase>
            <goals>
              <goal>build</goal>
              <goal>push</goal>
            </goals>
            <configuration>
              <images>
                <image>
                  <name>gcr.io/cis-us/acmeprotect/cloudapp</name>
                  <build>
                    <dockerFile>Dockerfile</dockerFile>
                    <tags>
                      <tag>release</tag>
                    </tags>
                    <labels>
                      <Built-By>jbochenski</Built-By>
                      <Built-On>09/01/2016 13:03:08</Built-On>
                      <Source-Revision>${buildNumber}</Source-Revision>
                      <Source-Branch>${scmBranch}</Source-Branch>
                      <Maven-Artifact>com.acme.acme.cloudapp:acme-main:1.5.0-SNAPSHOT</Maven-Artifact>
                    </labels>
                    <assembly>
                      <descriptor>/home/jbochenski/acme/acme/modules/acme-main/src/assembly/docker.xml</descriptor>
                      <basedir>/opt/acme</basedir>
                    </assembly>
                  </build>
                </image>
              </images>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <images>
            <image>
              <name>gcr.io/cis-us/acmeprotect/cloudapp</name>
              <build>
                <dockerFile>Dockerfile</dockerFile>
                <tags>
                  <tag>release</tag>
                </tags>
                <labels>
                  <Built-By>jbochenski</Built-By>
                  <Built-On>09/01/2016 13:03:08</Built-On>
                  <Source-Revision>${buildNumber}</Source-Revision>
                  <Source-Branch>${scmBranch}</Source-Branch>
                  <Maven-Artifact>com.acme.acme.cloudapp:acme-main:1.5.0-SNAPSHOT</Maven-Artifact>
                </labels>
                <assembly>
                  <descriptor>/home/jbochenski/acme/acme/modules/acme-main/src/assembly/docker.xml</descriptor>
                  <basedir>/opt/acme</basedir>
                </assembly>
              </build>
            </image>
          </images>
        </configuration>
      </plugin>

@rhuss
Copy link
Collaborator

rhuss commented Sep 1, 2016

The issue here is, that you select the Dockerfile mode with <dockerFile> in which other config options influencing the Dockerfile are ignored. Labels and Envs are such things which are not added when using the Dockerfile mode.

Currently you have two options:

@jakub-bochenski
Copy link
Contributor Author

OK, apparently I didn't read the docs carefully enough here also

How about emitting a warning when one is using options not compatible with one another (like the labels vs dockerfile here)?

@KonradCichocki7
Copy link

I also expected labels will be added to my image even though I have a dockerfile (if that counts:D)

@rhuss
Copy link
Collaborator

rhuss commented Jan 6, 2017

Agreed, I added it to #205 as a nice feature to have.

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

3 participants