error
on project cxxxx: Could not build image: COPY failed: stat /var/lib/docker/tmp/docker-builder008444946/target/cxxx-1.0.jar: no such file or directory ->
Got the same problem when configuring the plugin like the following:
<configuration>
<repository>foobar/${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.directory}/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
It uses a Dockerfile like this:
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY ./${JAR_FILE} app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap", "-jar", "/app.jar"]
Got it working, fixing the configuration like this:
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
I read somewhere it has to do with the location of the file (referenced as JAR_FILE in my case) which MUST be relative to the location of the Dockerfile. In my case it lives besides the target folder.
It seems to be an issue related to the docker binary itself...
Hope this helps !
thanks ,my pom is
Il giorno dom 22 lug 2018 alle ore 16:46 Mathieu BODIN <
[email protected]> ha scritto:
Got the same problem when configuring the plugin like the following:
foobar/${project.artifactId}
${project.version}
${project.build.directory}/${project.build.finalName}.jar
It uses a Dockerfile like this:
FROM openjdk:8-jdk-alpineVOLUME /tmpARG JAR_FILECOPY ./${JAR_FILE} app.jarENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap", "-jar", "/app.jar"]
Got it working, fixing the configuration like this:
target/${project.build.finalName}.jar
I read somewhere it has to do with the location of the file (referenced as
JAR_FILE in my case) which MUST be relative to the location of the
Dockerfile.It seems to be an issue related to the docker binary itself...
Hope this helps !
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/spotify/dockerfile-maven/issues/198#issuecomment-406871877,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACZspMNqIq7TBFYEZLM99Tr6CkTXjmsfks5uJJBLgaJpZM4VZovS
.
I tried to copy yours config .... no difference :(
Your pom looks fine, could you check the location of your Dockerfile in the project ?
How did you referenced JAR_FILE in the Dockerfile ?
In my case, I've got something like:
foobar (Maven project root)
|-> (other stuff...)
|-> pom.xml (where the plugin definition lives)
|-> Dockerfile
|-> target
|-> foobar-1.0.0-SNAPSHOT.jar (what is referenced as JAR_FILE)
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<configuration>
<repository>foobar/${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
I m using intellij as IDE editor, but maven for docker is executed by console.
in the main directory
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
(in future i want run apps not as root)
Executing plugin i can see it is stopping in 4th instruction
what docker version have you got?
mime is Docker version 17.12.1-ce, build 7390fc6
Errors were discovered while reifying SystemDescriptor(
implementation=org.glassfish.jersey.message.internal.DataSourceProvider
contracts={com.spotify.docker.client.shaded.javax.ws.rs.ext.MessageBodyWriter,com.spotify.docker.client.shaded.javax.ws.rs.ext.MessageBodyReader}
scope=com.spotify.docker.client.shaded.javax.inject.Singleton
qualifiers={}
descriptorType=CLASS
descriptorVisibility=NORMAL
metadata=
rank=0
loader=org.glassfish.hk2.utilities.binding.AbstractBinder$2@fbbb0dd
proxiable=null
proxyForSameScope=null
analysisName=null
id=12
locatorId=2
identityHashCode=193213938
reified=false)
at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:689)
at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:458)
at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2205)
at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:122)
at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1350)
at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1345)
at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:116)
at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1407)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1332)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1321)
at org.glassfish.jersey.internal.inject.Providers.getServiceHandles(Providers.java:354)
at org.glassfish.jersey.internal.inject.Providers.getProviders(Providers.java:187)
at org.glassfish.jersey.message.internal.MessageBodyFactory.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1350)
at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:271)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:365)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022)
at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:765)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getUnqualifiedService(ServiceLocatorImpl.java:772)
at org.jvnet.hk2.internal.IterableProviderImpl.get(IterableProviderImpl.java:111)
at org.glassfish.jersey.client.RequestProcessingInitializationStage.apply(RequestProcessingInitializationStage.java:97)
at org.glassfish.jersey.client.RequestProcessingInitializationStage.apply(RequestProcessingInitializationStage.java:67)
at org.glassfish.jersey.process.internal.Stages$LinkedStage.apply(Stages.java:308)
at org.glassfish.jersey.process.internal.Stages.process(Stages.java:171)
at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:158)
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.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.6:build (default-cli) on project cxxx: Could not build image: COPY failed: stat /var/lib/docker/tmp/docker-builder717092628/target/cxxxx-1.0.jar: no such file or directory -> [Help 1]
I monitored the temp dir created by docker
and docker-builder215467635 is wrong ... it is created a dir but with different id
In your Dockerfile, try:
COPY ./${JAR_FILE} app.jar
Or in your pom.xml, something like:
<JAR_FILE>./target/${project.build.finalName}.jar</JAR_FILE>
Doing so, it would be relative to where the Dockerfile is built. Note, I'm less sure for the second option...
same result
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.
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.
This is BS! Issue was never fixed..
@jl2035 Exactly. There are many related issues but none of them solved the problem.
Most helpful comment
Got the same problem when configuring the plugin like the following:
It uses a Dockerfile like this:
Got it working, fixing the configuration like this:
I read somewhere it has to do with the location of the file (referenced as JAR_FILE in my case) which MUST be relative to the location of the Dockerfile. In my case it lives besides the target folder.
It seems to be an issue related to the docker binary itself...
Hope this helps !