spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.66k stars 575 forks source link

Exception caught: Illegal character in authority at index 7: http://<host>:2375 #354

Closed FloPrm closed 6 years ago

FloPrm commented 6 years ago

Description

I'm trying to mvn package a Docker project, which includes docker-maven-plugin.

The .pom :

`

4.0.0 [Group Name] [Articfact Id] 7.0.0-SNAPSHOT [Articfact Id] Docker-Batch 7.0.0-SNAPSHOT The Docker Batch module. Allow to build an image for Batch component. [Group Id] [Articfact Id] com.spotify docker-maven-plugin 0.4.13 package build ${project.basedir}/src ${project.artifactId}:${project.version} true ${project.version} latest / ${project.build.directory} batch.zip org.apache.maven.plugins maven-dependency-plugin copy ${project.groupId} [Articfact Id] batch ${project.parent.version} zip ${project.build.directory} batch.zip

`

What do you expect

Normal mvn package.

What happened instead

Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default) on project mct-docker-batch: Exception caught: Illegal character in authority at index 7: http://:2375

Software:

Full backtrace

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default) on project mct-docker-batch: Exception caught: Illegal character in authority at index 7: http://<host>:2375 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default) on project mct-docker-batch: Exception caught
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception caught
        at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:141)
        at com.spotify.docker.BuildMojo.execute(BuildMojo.java:86)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
Caused by: java.lang.IllegalArgumentException: Illegal character in authority at index 7: http://<host>:2375
        at java.net.URI.create(URI.java:852)
        at com.spotify.docker.client.DefaultDockerClient$Builder.uri(DefaultDockerClient.java:1741)
        at com.spotify.docker.client.DefaultDockerClient.fromEnv(DefaultDockerClient.java:1704)
        at com.spotify.docker.AbstractDockerMojo.getBuilder(AbstractDockerMojo.java:146)
        at com.spotify.docker.AbstractDockerMojo.buildDockerClient(AbstractDockerMojo.java:153)
        at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:138)
        ... 23 more
Caused by: java.net.URISyntaxException: Illegal character in authority at index 7: http://<host>:2375
        at java.net.URI$Parser.fail(URI.java:2848)
        at java.net.URI$Parser.parseAuthority(URI.java:3186)
        at java.net.URI$Parser.parseHierarchical(URI.java:3097)
        at java.net.URI$Parser.parse(URI.java:3053)
        at java.net.URI.<init>(URI.java:588)
        at java.net.URI.create(URI.java:850)
        ... 28 more
mattnworb commented 6 years ago

The plugin looks at the DOCKER_HOST environment variable (or the <dockerHost> configuration setting in your pom.xml, if set) to determine what address to use when connecting to the docker daemon.

It sounds like your DOCKER_HOST environment variable might have the literal value of http://<host>:2375? The <host> in the documentation is meant to be a placeholder, filled in with the real hostname of where the docker daemon is running (typically localhost, but the value depends on where the docker daemon that you want to connect to is actually running).

davidxia commented 6 years ago

closing due to inactivity.

winterfellding commented 5 years ago

You may need to check the redis connect url, especially there may be some space after the connect url, that will cause this exception thrown