6

I've got a Spring Boot project which I want to built an image from and push to a Docker private registry. I've followed Spring Boot official docs for that, using the Spotify Docker Maven plugin. That worked well when publishing my image to a docker local instance using Boot2Docker.

Now I'm trying to do the same with a remote private repo (an unsecured one) and I'm struggling with it. I've followed the plugin documentation for that and that's how my configuration looks like:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>com.spotify</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.4.9</version>
            <configuration>
                <imageName>service-discovery</imageName>
                <dockerDirectory>src/main/docker</dockerDirectory>
                <resources>
                    <resource>
                        <targetPath>/</targetPath>
                        <directory>${project.build.directory}</directory>
                        <include>${project.build.finalName}.war</include>
                    </resource>
                </resources>
            </configuration>
              <executions>
                <execution>
                  <id>build-image</id>
                  <phase>package</phase>
                  <goals>
                    <goal>build</goal>
                  </goals>
                </execution>
                <execution>
                  <id>tag-image</id>
                  <phase>package</phase>
                  <goals>
                    <goal>tag</goal>
                  </goals>
                  <configuration>
                    <image>service-discovery</image>
                    <newName>develop01.mycompany.com:5000/service-discovery</newName>
                  </configuration>
                </execution>
              </executions>
        </plugin>
    </plugins>
</build>

My registry is accessible through http://develop01.mycompany.com:5000, but the docker plugin seems not to be able to find it.

Executing mvn clean install throws:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.9:build (buil d-image) on project service-discovery: Exception caught: java.util.concurrent.Ex ecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingExcepti on: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [lo calhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connec t -> [Help 1]

Executing mvn docker:tag -DpushImage throws:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.9:tag (defaul t-cli) on project service-discovery: The parameters 'image', 'newName' for goal com.spotify:docker-maven-plugin:0.4.9:tag are missing or invalid -> [Help 1]

So the plugin seems not to recognize the parameters into the image goal (in fact, it looks like it's trying to connect to a local Docker instance when executing mvn clean install).

Software:

  • docker version: Server: 1.11.0
  • docker-maven-plugin version: 0.4.9
  • maven version: 3.2.3

A link to the GitHub issue I created


Update

I have set my DOCKER_HOST environment variable to tcp://develop01.mycompany.com:5000 and now the plugin seems to pick it. Still don't understand why I have to do it through an environment variable, when I'm declaring the server name in the execution configuration. All in all, that's the error I'm getting right now:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.9:build (buil d-image) on project service-discovery: Exception caught: Request error: GET http ://develop01.mycompany.com:5000/version: 404: HTTP 404 Not Found -> [Help 1]

In fact, the /version endpoint of my registry returns 404. The /v2 endpoint however, returns an empty JSON. Is the plugin trying to deal with a previous docker version API?

Paul Verest
  • 60,022
  • 51
  • 208
  • 332
Aritz
  • 30,971
  • 16
  • 136
  • 217
  • 2
    I have fixed this issue by following below link. http://stackoverflow.com/questions/34815411/docker-maven-plugin-clientprotocolexception-windows-10-using-docker-toolbox – springbootlearner Nov 08 '16 at 04:07

0 Answers0