docker-maven-plugin: Use connect timeout for Named Pipes

At least on Windows, the plugin frequently logs retry attempts when connecting to the docker host via named pipes:

[INFO] I/O exception (java.io.FileNotFoundException) caught when processing request to {}->npipe://127.0.0.1:1: \\.\pipe\docker_engine (all pipe instances are busy)
[INFO] Retrying request to {}->npipe://127.0.0.1:1
[INFO] I/O exception (java.io.FileNotFoundException) caught when processing request to {}->npipe://127.0.0.1:1: \\.\pipe\docker_engine (all pipe instances are busy)
[INFO] Retrying request to {}->npipe://127.0.0.1:1
[INFO] I/O exception (java.io.FileNotFoundException) caught when processing request to {}->npipe://127.0.0.1:1: \\.\pipe\docker_engine (all pipe instances are busy)
[INFO] Retrying request to {}->npipe://127.0.0.1:1
[ERROR] DOCKER> Cannot create docker access object  [Cannot extract API version from server npipe://127.0.0.1:1 : \\.\pipe\docker_engine (all pipe instances are busy)]

The build then fails with this exception:

[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.25.2:start (start) on project geo-persistence: Cannot create docker access object: Cannot extract API version from server npipe://127.0.0.1:1 : \\.\pipe\docker_engine (all pipe instances are busy) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:docker-maven-plugin:0.25.2:start (start) on project geo-persistence: Cannot create docker access object 
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	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:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	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)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot create docker access object 
	at io.fabric8.maven.docker.service.DockerAccessFactory.createDockerAccess(DockerAccessFactory.java:52)
	at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:219)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 21 more
Caused by: io.fabric8.maven.docker.access.DockerAccessException: Cannot extract API version from server npipe://127.0.0.1:1 : \\.\pipe\docker_engine (all pipe instances are busy)
	at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.getServerApiVersion(DockerAccessWithHcClient.java:105)
	at io.fabric8.maven.docker.service.DockerAccessFactory.createDockerAccess(DockerAccessFactory.java:45)
	... 24 more
Caused by: java.io.FileNotFoundException: \\.\pipe\docker_engine (all pipe instances are busy)
	at java.io.RandomAccessFile.open0(Native Method)
	at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
	at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
	at java.io.RandomAccessFile.<init>(RandomAccessFile.java:124)
	at io.fabric8.maven.docker.access.hc.win.NamedPipe.connect(NamedPipe.java:59)
	at io.fabric8.maven.docker.access.hc.util.AbstractNativeSocketFactory.connectSocket(AbstractNativeSocketFactory.java:42)
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
	at org.apache.http.impl.conn.BasicHttpClientConnectionManager.connect(BasicHttpClientConnectionManager.java:323)
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140)
	at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate.get(ApacheHttpClientDelegate.java:67)
	at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.getServerApiVersion(DockerAccessWithHcClient.java:101)
	... 25 more

In my case, this happens when a build execution is directly followed by a start execution.

The connect timeout that is passed to io.fabric8.maven.docker.access.hc.win.NamedPipe#connect(java.net.SocketAddress, int) is 0. Apart from that, the parameter is not even used here. So the retries carried out by the Apache HttpClient happen instantly and show no effect. In contrast, if I wait 10-20 seconds and execute the plugin again, it usually works. So I guess this would just require some waiting time in between retries in order to work.

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Reactions: 2
  • Comments: 15

Most upvoted comments

this did the trick for us in the configuration section: <dockerHost>tcp://localhost:2375</dockerHost> (note tcp instead of http as my docker exposes its proper daemon)

Sprry, I’m really not a Windows expert. I wonder whether there is a limitation how many parallel request can be performed on NamedPipe (which is used to access the Windows Docker daemon).

Any Window expert out there able to help in fixing this issue ?

You may try setting dockerHost like <dockerHost>http://localhost:2375</dockerHost>

Thanks, the configuration with TCP helped me as well. Just wanted to mention that you also need to enable TCP in your settings. In Docker Desktop(Windows) its possible to enable it under “General”.