We use dockerfile-maven version "1.3.6" for building docker image and publishing it to our private
docker repo from jenkins build.
But image building fails with error:
I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: Connection reset by peer
org.apache.maven.plugin.MojoExecutionException: Could not build image
at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:185)
at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:105)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:240)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:229)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
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:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132)
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:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186)
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:497)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:133)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:68)
at hudson.remoting.UserRequest.perform(UserRequest.java:152)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:332)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.client.ClientProtocolException
at com.spotify.docker.client.DefaultDockerClient.propagate(DefaultDockerClient.java:2512)
at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:2454)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1393)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1365)
at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:178)
... 35 more
Caused by: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.client.ClientProtocolException
at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)
at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286)
at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:2452)
... 38 more
Caused by: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.client.ClientProtocolException
at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:481)
at org.glassfish.jersey.apache.connector.ApacheConnector$1.run(ApacheConnector.java:491)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at jersey.repackaged.com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:50)
at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:37)
at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:487)
at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:178)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:340)
at org.glassfish.jersey.client.ClientRuntime$3.run(ClientRuntime.java:210)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
... 4 more
Caused by: org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:435)
... 21 more
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:107)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
... 23 more
Caused by: java.io.IOException: Connection reset by peer
at jnr.enxio.channels.NativeSocketChannel.write(NativeSocketChannel.java:93)
at java.nio.channels.Channels.writeFullyImpl(Channels.java:78)
at java.nio.channels.Channels.writeFully(Channels.java:98)
at java.nio.channels.Channels.access$000(Channels.java:61)
at java.nio.channels.Channels$1.write(Channels.java:174)
at
[operations@s01-docker-001 ~]$ docker info
Containers: 3
Running: 0
Paused: 0
Stopped: 3
Images: 105
Server Version: 17.09.0-ce
Storage Driver: devicemapper
Pool Name: docker-8:3-789233-pool
Pool Blocksize: 65.54kB
Base Device Size: 107.4GB
Backing Filesystem: ext4
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 5.415GB
Data Space Total: 107.4GB
Data Space Available: 102GB
Metadata Space Used: 7.217MB
Metadata Space Total: 2.147GB
Metadata Space Available: 2.14GB
Thin Pool Minimum Free Space: 10.74GB
Udev Sync Supported: true
Deferred Removal Enabled: true
Deferred Deletion Enabled: true
Deferred Deleted Device Count: 0
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.140-RHEL7 (2017-05-03)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-327.10.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 5.672GiB
Name: s01-docker-001.dev.xxxx.com
ID: WPNH:ZJA5:CQZH:DUXG:2FEW:UDUR:BL6W:FACC:XZDG:LDY2:FYX2:73T2
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 20
Goroutines: 27
System Time: 2018-01-05T10:12:32.972481981-08:00
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
docker-registry.dev.xxxx.com:5000
127.0.0.0/8
Live Restore Enabled: false
{
"insecure-registries": ["docker-registry.dev.mobileiron.com:5000"],
"debug": true,
"hosts": ["tcp://127.0.0.1:2375", "unix:///var/run/docker.sock"]
}
Tried most of the mentioned solution with NO resolution.
Any help will unblock us.
I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: Connection reset by peer
Typically this means that the docker daemon is not actually listening at the DOCKER_HOST address. What are you setting DOCKER_HOST too, if you are setting it?
Its set to DOCKER_HOST unix:///var/run/docker.sock
Does it work from the command-line? i.e. what does DOCKER_HOST=unix:///var/run/docker.sock docker ps output for you?
Yes. Here is the o/p
operations@s01-docker-001 ~]$ export DOCKER_HOST=unix:///var/run/docker.sock
[operations@s01-docker-001 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Having the same issue, on mac os and ubuntu linux
Having same issue on Ubuntu.
Had the same issue.
Solved it by fixing a duplicate (unwanted) slash at the image name:
before:
<repo>/<prefix>//<service>:<tag>
after:
<repo>/<prefix>/<service>:<tag>
Not sure why or whether at all this caused the problem.
Not in my case. The repo name is correct.
I managed to resolve it by just adding the name in the
I have faced the similar issue, solved by replacing the POM.xml file from https://github.com/spring-guides/gs-spring-boot-docker/blob/master/complete/pom.xml
I have the same issue ,
I am trying to run a Jenkins pipeline i make maven build, and using a spotify to convert artifact to docker image and to push it to docker hub.
I am running build on kuberenetes pod with a docker dind/jdk/mvn/ image
but its on failing with one constant error:
Mar 27, 2018 2:12:48 AM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: No such file or directory
Mar 27, 2018 2:12:48 AM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://localhost:80
Mar 27, 2018 2:12:48 AM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: No such file or directory
Mar 27, 2018 2:12:48 AM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://localhost:80
Mar 27, 2018 2:12:48 AM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: No such file or directory
Mar 27, 2018 2:12:48 AM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://localhost:80
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.0:build (default) on project stocky-service: Could not build image: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: No such file or directory -> [Help 1]
[ERROR]
when I am running on my local machine, I am not finding any issue, but when it comes to Jenkins pipeline its throwing error
Have you tried to rename your image name to all lowercase letters? Ex: /dockerImage:1.0 -> /dockerimage:1.0
When this problem occurs with me (java.io.IOException: No such file or directory) it was because Docker service was down.
Setting group and artifact id to all lowercase worked for me too. Weird issue.
Looks like it's an issue with casing.
@ptdien thanks, solve for me
@davidxia we just bumped into that as well. Could this be documented or fixed? ;-)
Lowercase characters only in image name solved the problem for me too.
I am trying to create an archetype project for a micro-service that is packaged as a docker image.
In this process, I tried to use __rootArtifactId__ as the image name. Replacing it with a lowercase
name resolved the issue.
Wow this should be really reopened and FIXED!!! Still exists in Version 1.2.0!
Wow this should be really reopened and FIXED!!! Still exists in Version 1.2.0!
+1
Wow this should be really reopened and FIXED!!! Still exists in Version 1.2.0!
Version 1.4.9!
+1
You should set DOCKER_HOST:
export DOCKER_HOST=tcp://your_ip:2375
mvn package -Dmaven.test.skip=true -U
mvn dockerfile:build
mvn dockerfile:push
In my case, I have a / in my image tag, I remove it and all errors gone
in my case, it's just because docker machine is stopped. then i started it, and problem gone.
in my case (trying to push to an AWS ECR), it was because my "repository" had an https:// in front of it, e.g.:
BAD:
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${version.dockerfile-maven-version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>https://123456789.dkr.ecr.us-east-1.amazonaws.com/foo</repository>
....snip
GOOD:
<configuration>
<repository>123456789.dkr.ecr.us-east-1.amazonaws.com/foo</repository>
I know it's quite unrelated dockerfile-maven, but I got this error when (unwittingly) running docker within docker.
My solution was to run the parent docker image with 'docker run -v /var/run/docker.sock:/var/run/docker.sock'.
Still getting this error, dind, jenkins pipeline running on k8 cluster with pod, so I cannot set DOCKER_HOST, and image name all lowercase, any other ideas to solve this?
May 28, 2019 2:18:49 AM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: No such file or directory
Just encountered this error. Just remove lowercase letters in the image name and it works.
This issue seems to be back in version 1.4.10, works fine in 1.4.9 even with uppercase tags, ex. my.ecr.host.amazonaws.com/myproject/myrepo:0.1.2-SNAPSHOT
When this problem occurs with me (java.io.IOException: No such file or directory) it was because Docker service was down.
This is the first thing that should be comming in mind when facing this issue.Thanks for your crispy and nice answer
This issue is about I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80…, which happens if the image name isn't all-lowercase.
It is not to discuss permission problems, or mounting problems.
Can we please keep this issue on-topic?
still an issue in 1.4.13, case of the image name is irrelevant
Hi,
I also got hit by this issue: converting to lowercase seems to fix.
Can we re-open it please?
Here's my version (Ubuntu 16.04)
Client:
Version: 18.09.7
API version: 1.39
Go version: go1.10.1
Git commit: 2d0083d
Built: Fri Aug 16 14:20:06 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.09.7
API version: 1.39 (minimum version 1.12)
Go version: go1.10.1
Git commit: 2d0083d
Built: Wed Aug 14 19:41:23 2019
OS/Arch: linux/amd64
i think t's need reopen,
i had this question!
For me the docker daemon wasn't running. After I started it, it succeeded.
For me it was, that I had forgotten to enable the experimental features in Docker, and yet I had <squash>true</squash> in my pom.xml
For me the Docker was not running on Gitlab-Runner. I did the following to get it resolved:
Exposed the docker daemon on the 0.0.0.0 on the host machine (File: /lib/systemd/system/docker.service), following entry:
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 --containerd=/run/containerd/containerd.sock
Reloaded Docker Daemon
systemctl daemon-reload
Restarted the Docker Daemon
sudo service docker restart
Verified the curl command both from GItlab docker container and the host machine
curl http://172.17.0.1:2375/version
Added the following in gitlab ci file (Filename: .gitlab-ci.yml)
before_script:
please check java version , and check access 775 for Dockerfile and Dockerdir and checked docker file have a EntryPoint .
Most helpful comment
Have you tried to rename your image name to all lowercase letters? Ex: /dockerImage:1.0 -> /dockerimage:1.0