Dockerfile-maven: An HTTPS URI for DOCKER_HOST must be provided to use Docker client certificates

Created on 12 Jul 2017  路  3Comments  路  Source: spotify/dockerfile-maven

Hi.

We tried to move from 'docker-maven-plugin' to this one. But we can't build the image on 'OS X El Captain"

For the examples below we are always running

mvn clean verify -P docker

Our first two attempts were with

export DOCKER_HOST=tcp://localhost:2375

and

export DOCKER_HOST=https://localhost:2375

which yielded

[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.3:build (default) on project my-api: Could not build image: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused -> [Help 1]

Then we tried

export DOCKER_HOST=unix:///var/run/docker.sock

which gave us

[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.3:build (default) on project my-api: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.3:build failed: An HTTPS URI for DOCKER_HOST must be provided to use Docker client certificates -> [Help 1]

We can't find any docs on how to get it working.

My pom.xml for reference

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>my.package</groupId>
        <artifactId>myapp</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>myapi</artifactId>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <scala.version>2.12.2</scala.version>
        <scala-maven-plugin.version>3.2.2</scala-maven-plugin.version>
        <logback.version>1.2.3</logback.version>
        <akka.version>10.0.9</akka.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-http_2.12</artifactId>
            <version>${akka.version}</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-http-spray-json_2.12</artifactId>
            <version>${akka.version}</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.scala-logging</groupId>
            <artifactId>scala-logging_2.12</artifactId>
            <version>3.7.1</version>
        </dependency>
        <dependency>
            <groupId>net.logstash.logback</groupId>
            <artifactId>logstash-logback-encoder</artifactId>
            <version>4.11</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>${scala-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <scalaVersion>${scala.version}</scalaVersion>
                    <scalaCompatVersion>2.12</scalaCompatVersion>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml
                    </dependencyReducedPomLocation>
                    <transformers>
                        <transformer
                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <mainClass>my.package.MainApi</mainClass>
                        </transformer>
                        <transformer
                                implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                            <resource>reference.conf</resource>
                        </transformer>
                    </transformers>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>docker</id>
            <build>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                    </resource>
                    <resource>
                        <directory>${project.basedir}/docker</directory>
                        <targetPath>${project.build.directory}</targetPath>
                        <includes>
                            <include>Dockerfile</include>
                        </includes>
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <groupId>com.spotify</groupId>
                        <artifactId>dockerfile-maven-plugin</artifactId>
                        <version>1.3.3</version>
                        <executions>
                            <execution>
                                <id>default</id>
                                <goals>
                                    <goal>build</goal>
                                    <goal>push</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
stale

Most helpful comment

This issue is only caused by the presence of certs in ~/.docker.

I followed a workaround suggested in this issue to get back on track in the meantime.

All 3 comments

This issue is only caused by the presence of certs in ~/.docker.

I followed a workaround suggested in this issue to get back on track in the meantime.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Has anybody found a solution to this? Thanks

Was this page helpful?
0 / 5 - 0 ratings