Dockerfile-maven: Problem with * and ** in .dockerignore

Created on 1 Nov 2017  Â·  5Comments  Â·  Source: spotify/dockerfile-maven

Hello!

There is a bug somehow connected with .dockerignore file. While I have either * or ** line in it, I get next error:

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:134)
    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:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    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:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: com.spotify.docker.client.exceptions.DockerRequestException: Request error: POST unix://localhost:80/build?pull=true&t=repo%2Fsitory%3Atest: 500, body: {"message":"Cannot locate specified Dockerfile: Dockerfile"}

    at com.spotify.docker.client.DefaultDockerClient.propagate(DefaultDockerClient.java:2504)
    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)
    ... 25 more
Caused by: com.spotify.docker.client.shaded.javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
    at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:1020)
    at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:816)
    at org.glassfish.jersey.client.JerseyInvocation.access$700(JerseyInvocation.java:92)
    at org.glassfish.jersey.client.JerseyInvocation$5.completed(JerseyInvocation.java:773)
    at org.glassfish.jersey.client.ClientRuntime.processResponse(ClientRuntime.java:198)
    at org.glassfish.jersey.client.ClientRuntime.access$300(ClientRuntime.java:79)
    at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:180)
    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)
    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)

Building image with Docker (docker build -t repo/sitory .) works perfectly fine.

Removing aforementioned line from .dockerignore works too, but creates new problem.
That is the build log without *:

Sending build context to Docker daemon  315.4MB
...

That is the build log with *

Sending build context to Docker daemon  7.589MB
...

Additional info:

      System Version: macOS 10.12.6 (16G29)
      Kernel Version: Darwin 16.7.0
      Docker Version 17.10.0-ce-mac36 (19824)
stale

Most helpful comment

Add !Dockerfile to .dockerignore

All 5 comments

“HTTP 500 Internal Server Error” is coming from the docker daemon’s API. Do you see anything related in the daemon’s logs?

Can you share your exact .dockerignore file contents?

Add !Dockerfile to .dockerignore

Happend the same to me

While the docker CLI automatically sends Dockerfile and .dockerignore even if they would otherwise be excluded by a pattern in the .dockerignore, this plugin does not.

https://docs.docker.com/engine/reference/builder/#dockerignore-file

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.

Was this page helpful?
0 / 5 - 0 ratings