spotify / dockerfile-maven

MATURE: A set of Maven tools for dealing with Dockerfiles
Apache License 2.0
2.75k stars 493 forks source link

java.io.FileNotFoundException: \\.\pipe\docker_engine #343

Closed jiangyongbing24 closed 4 years ago

jiangyongbing24 commented 4 years ago

Is this a BUG REPORT or FEATURE REQUEST?:

BUG REPORT

Description

Appears when trying to generate a image java.io.FileNotFoundException: \. \ pipe \ docker_engine error

How to reproduce

I set DOCKER_HOST to a remote connection on the win10 operating system, and then set a Dockerfile file in the root directory of my springboot application as follows:

FROM openjdk:8-jre

MAINTAINER JYB

ARG JAR_FILE

ADD target/${JAR_FILE} app.jar

ENTRYPOINT ["java", "-jar", "/app.jar"]

pom.xml

           <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>${dockerfile-maven-version}</version>
                <executions>
                    <execution>
                        <id>default</id>
                        <goals>
                            <goal>build</goal>
                            <goal>push</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <repository>config-server</repository>
                    <tag>${project.version}</tag>
                    <dockerfile>./Dockerfile</dockerfile>
                    <buildArgs>
                        <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
                    </buildArgs>
                    <noCache>true</noCache>
                </configuration>
            </plugin>

The operating system to which the docker process belongs centos: 7

Error message:

Caused by: java.io.FileNotFoundException: \\.\pipe\docker_engine (系统找不到指定的文件。)
    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 com.spotify.docker.client.npipe.NamedPipeSocket.connect (NamedPipeSocket.java:72)
    at com.spotify.docker.client.npipe.NpipeConnectionSocketFactory.connectSocket (NpipeConnectionSocketFactory.java:76)
    at com.spotify.docker.client.shaded.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect (DefaultHttpClientConnectionOperator.java:134)
    at com.spotify.docker.client.shaded.org.apache.http.impl.conn.BasicHttpClientConnectionManager.connect (BasicHttpClientConnectionManager.java:338)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.establishRoute (MainClientExec.java:380)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.execute (MainClientExec.java:236)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.ProtocolExec.execute (ProtocolExec.java:184)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec.execute (RetryExec.java:88)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RedirectExec.execute (RedirectExec.java:110)
    at com.spotify.docker.client.shaded.org.apache.http.impl.client.InternalHttpClient.doExecute (InternalHttpClient.java:184)
    at com.spotify.docker.client.shaded.org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:71)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply (ApacheConnector.java:435)
    at com.spotify.docker.client.shaded.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 com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply (ApacheConnector.java:487)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$2.run (ClientRuntime.java:178)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call (Errors.java:271)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call (Errors.java:267)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:315)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:297)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:267)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.process.internal.RequestScope.runInScope (RequestScope.java:340)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$3.run (ClientRuntime.java:210)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)

What do you expect

[Describe what do you expect to happen]

What happened instead

[Describe the actual results]

Software:

belovednnll commented 4 years ago

I also encountered the same problem

dhaigang commented 4 years ago

I also encountered the same problem

wxywizard commented 4 years ago

I also encountered the same problem

jiangyongbing24 commented 4 years ago

I also encountered the same problem

It seems that no one has maintained it, I suggest you use jib-maven-plugin.

wxywizard commented 4 years ago

I also encountered the same problem

It seems that no one has maintained it, I suggest you use jib-maven-plugin.

谢谢,有没有demo参考下?

jiangyongbing24 commented 4 years ago

I also encountered the same problem

It seems that no one has maintained it, I suggest you use jib-maven-plugin.

谢谢,有没有demo参考下?

官方文档,这个插件跟dockerfile-plugin不同的是,它不需要本地安装docker环境,也不需要连接远程docker环境

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>${jib-plugin-version}</version>
                <configuration>
                    <from>
                        <image>仓库地址/镜像:版本号</image>
                        <username>xxxx</username>
                        <password>xxxx</password>
                    </from>
                    <to>
                        <image>仓库地址/镜像:版本号</image>
                        <username>xxxx</username>
                        <password>xxxx</password>
                    </to>
                    <container>
                        <jvmFlags>
                            <jvmFlag>-Dspring.profiles.active=prod</jvmFlag>
                            <jvmFlag>-Xms512m</jvmFlag>
                            <jvmFlag>-Xdebug</jvmFlag>
                        </jvmFlags>
                        <ports>
                            <port>8080</port>
                        </ports>
                    </container>
                </configuration>
                <executions>
                    <execution>
                        <id>jib-maven-plugin</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
wxywizard commented 4 years ago

I also encountered the same problem

It seems that no one has maintained it, I suggest you use jib-maven-plugin.

谢谢,有没有demo参考下?

官方文档,这个插件跟dockerfile-plugin不同的是,它不需要本地安装docker环境,也不需要连接远程docker环境

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>${jib-plugin-version}</version>
                <configuration>
                    <from>
                        <image>仓库地址/镜像:版本号</image>
                        <username>xxxx</username>
                        <password>xxxx</password>
                    </from>
                    <to>
                        <image>仓库地址/镜像:版本号</image>
                        <username>xxxx</username>
                        <password>xxxx</password>
                    </to>
                    <container>
                        <jvmFlags>
                            <jvmFlag>-Dspring.profiles.active=prod</jvmFlag>
                            <jvmFlag>-Xms512m</jvmFlag>
                            <jvmFlag>-Xdebug</jvmFlag>
                        </jvmFlags>
                        <ports>
                            <port>8080</port>
                        </ports>
                    </container>
                </configuration>
                <executions>
                    <execution>
                        <id>jib-maven-plugin</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

谢谢 但是我这么配置 它报错了

   > ```yaml
 >      <plugin>
     >      <groupId>com.google.cloud.tools</groupId>
 >      <artifactId>jib-maven-plugin</artifactId>
 >      <version>1.7.0</version>
 >      <configuration>
 >      <from>
 >          <image>172.20.32.41:3272/hub.c.163.com/springcloud/java8</image>
 >      </from>
 >      <to>
 >          <image>172.20.32.41:3272/sailing/${project.artifactId}:0.0.1</image>
 >      </to>
 >      <container>
 >          <jvmFlags>
 >          <jvmFlag>-Xms512m</jvmFlag>
 >          <jvmFlag>-Xdebug</jvmFlag>
 >          </jvmFlags>
 >          <ports>
 >          <port>7009</port>
 >          </ports>
 >      </container>
 >      <allowInsecureRegistries>true</allowInsecureRegistries> 
 >      </configuration>
 >      <executions>
 >      <execution>
 >          <id>jib-maven-plugin</id>
 >          <phase>package</phase>
 >          <goals>
 >          <goal>build</goal>
 >          </goals>
 >      </execution>
 >      </executions>
 >  </plugin>
     > ```

错误信息 [ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.7.0:build (jib-maven-plugin) on project datademo: Tried to retrieve authentication method for 172.20.32.41:3272 but failed because: registry returned error code 404; possible causes include invalid or wrong reference. Actual error output follows: [ERROR] {"message":"page not found"}

私有仓库是这么配置么?

wxywizard commented 4 years ago

I also encountered the same problem

It seems that no one has maintained it, I suggest you use jib-maven-plugin.

谢谢,有没有demo参考下?

官方文档,这个插件跟dockerfile-plugin不同的是,它不需要本地安装docker环境,也不需要连接远程docker环境

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>${jib-plugin-version}</version>
                <configuration>
                    <from>
                        <image>仓库地址/镜像:版本号</image>
                        <username>xxxx</username>
                        <password>xxxx</password>
                    </from>
                    <to>
                        <image>仓库地址/镜像:版本号</image>
                        <username>xxxx</username>
                        <password>xxxx</password>
                    </to>
                    <container>
                        <jvmFlags>
                            <jvmFlag>-Dspring.profiles.active=prod</jvmFlag>
                            <jvmFlag>-Xms512m</jvmFlag>
                            <jvmFlag>-Xdebug</jvmFlag>
                        </jvmFlags>
                        <ports>
                            <port>8080</port>
                        </ports>
                    </container>
                </configuration>
                <executions>
                    <execution>
                        <id>jib-maven-plugin</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

我想问下如果是 远程docker仓库地址是ip端口的话from应该这个配置吗:ip:端口/imagename:tag

jiangyongbing24 commented 4 years ago

I also encountered the same problem

It seems that no one has maintained it, I suggest you use jib-maven-plugin.

谢谢,有没有demo参考下?

官方文档,这个插件跟dockerfile-plugin不同的是,它不需要本地安装docker环境,也不需要连接远程docker环境

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>${jib-plugin-version}</version>
                <configuration>
                    <from>
                        <image>仓库地址/镜像:版本号</image>
                        <username>xxxx</username>
                        <password>xxxx</password>
                    </from>
                    <to>
                        <image>仓库地址/镜像:版本号</image>
                        <username>xxxx</username>
                        <password>xxxx</password>
                    </to>
                    <container>
                        <jvmFlags>
                            <jvmFlag>-Dspring.profiles.active=prod</jvmFlag>
                            <jvmFlag>-Xms512m</jvmFlag>
                            <jvmFlag>-Xdebug</jvmFlag>
                        </jvmFlags>
                        <ports>
                            <port>8080</port>
                        </ports>
                    </container>
                </configuration>
                <executions>
                    <execution>
                        <id>jib-maven-plugin</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

我想问下如果是 远程docker仓库地址是ip端口的话from应该这个配置吗:ip:端口/imagename:tag

是的

stale[bot] commented 4 years ago

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.