Docker Community Forums

Share and learn in the Docker community.

Docker Build Failed


(Iconist) #1

Hi I’m using io.fabric8 docker maven plugin

when I try to build docker file using Jenkins job I get the below error:
Here in my docker file I have harceded the value of the target library folder so I can addd it to my docker image using ADD command…

ADD /var/lib/jenkins/workspace/BuildIPFEngine/ipf-deploy-parent/ipf-deploy-engine/target/engine/lib /data/engine/lib…

My requirement is to push the dependencies under my project target/engine/lib folder to docker image.

Kindly advice:

ERROR:

[INFO] DOCKER> Step 3 : ADD /var/lib/jenkins/workspace/BuildIPFEngine/ipf-deploy-parent/ipf-deploy-engine/target/engine/lib /data/engine/lib
[ERROR] DOCKER> Unable to build image [icon/ipf-deploy-engine:1.1.0-SNAPSHOT]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.273 s
[INFO] Finished at: 2016-12-03T15:16:07+00:00
[INFO] Final Memory: 39M/1237M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.18.1:build (default-cli) on project ipf-deploy-engine: Unable to build image [icon/ipf-deploy-engine:1.1.0-SNAPSHOT]: lstat var/lib/jenkins/workspace/BuildIPFEngine/ipf-deploy-parent/ipf-deploy-engine/target/engine/lib: no such file or directory -> [Help 1]


(David Maze) #2

You can never ADD or COPY a file that’s not in the context directory of the build, usually the directory that contains the Dockerfile or a subdirectory of it. In particular, putting an absolute path here does not work.


(Iconist) #3

Thanks for reply…

So how do I achieve this ?

I want to copy the dependency lib’s under target/engine/lib under my project to the Docker image.

Thanks


(Iconist) #4

My Directory Structure is like below -

ipf-deploy-engine (LEVEL 1)
-----src (LEVEL 2)
------------docker (LEVL 3)
—Dockerfile (LEVEL 4)
-----pom.xml (LEVEL 2)
-----target (LEVEL 2)
-------engine (LEVEL 3)
---------lib (LEVEL 4)
---- jar’s (dependency jar’s) (LEVEL 5)

Level 1 : Project root
Level 2: Directly under project directory I have src folder, pom.xml & target folder.
Level 3: src - has docker folder under which I have my Dockerfile(LEVEL 4)
at Level 2: under target folder I have the generated dependencies under engine (Level 3)/ lib (Level 4) / Jar files (Level 5)


(Wushuting) #5

Did U solve this issue?I have the same problem