0

I am using XML Configuration method to generate Dockerfile for my project.The generated Dockerfile looks OK and it gets built fine. However when I run it it always fails with the error. We have created an internal base image for java that I'll call as baseImage

Error: Unable to access jarfile echo-0.0.1.jar Description Info

f-m-p version : 3.5.31
Maven version (mvn -v) : Apache Maven 3.3.9
Kubernetes / OpenShift setup and version : N/A

My POM file:

` io.fabric8 fabric8-maven-plugin 3.5.31

        <configuration>
            <images>
                <image>
                    <name>echo-image:latest</name>
                    <build>
                        <entryPoint>
                            <arg>java</arg>
                            <arg>-jar</arg>
                            <arg>/deployments/echo-0.0.1.jar</arg>
                        </entryPoint>
                        <from>com/baseimage</from>

                        <tags>
                            <tag>latest</tag>
                        </tags>
                        <ports>
                            <port>7000</port>
                        </ports>
                        <env>
                            <JAVA_LIB_DIR>/deployments</JAVA_LIB_DIR>
                        </env>
                        <assembly>
                            <basedir>/deployments</basedir>
                            <descriptorRef>artifact</descriptorRef>
                        </assembly>

                    </build>

                </image>
            </images>
        </configuration>
    </plugin>`

Generated Docker File:

FROM com/baseImage 
ENV JAVA_LIB_DIR=/deployments 
EXPOSE 7000 
COPY maven /deployments/ 
ENTRYPOINT ["java","-jar","/deployments/echo-0.0.1.jar"] 

mvn build:

mvn clean package fabric8:build

Docker run output:

Error: Unable to access jarfile /deployments/echo-0.0.1.jar

What am I missing? It is frustrating to not able to get this to work. Please help!

yamenk
  • 46,736
  • 10
  • 93
  • 87
A V
  • 261
  • 2
  • 5
  • 10
  • Is there a file in `./maven/echo-0.0.1.jar` on the host? The Dockerfile only copies the whole folder `./maven` to `/deployments` in the container. – Julian Dec 02 '17 at 23:02
  • 3
    Replace the ENTRYPOINT with `CMD ls -lah /deployments && whoami` and run the image for more info. It could also be a permission error or something like that – Julian Dec 02 '17 at 23:17
  • @Julian Or simply override the entrypoint with `docker run --entrypoint=...` – Markus W Mahlberg Dec 03 '17 at 08:35
  • @Julian, the JAR file exists here - ./maven/echo-0.0.1.jar. I'll run the CMD and let you know – A V Dec 04 '17 at 14:20
  • 2
    Solved: There was a typo in my generated JAR filename causing the issue. Thanks @Julian for the help! – A V Dec 04 '17 at 15:37

0 Answers0