spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.67k stars 575 forks source link

error parsing HTTP 403 response body: unexpected end of JSON input: "" #364

Closed gvasquez95 closed 6 years ago

gvasquez95 commented 6 years ago

Description

While building and pushing a project image from Jenkins to AWS ECR the Maven plugin interrupted it's execution with an HTTP 403 message.

Seems like it already uploaded some docker layer parts, as it has both requested the needed AWS IAM permissions and, it's showing in the log stats like the following ones:

6c48349df066: Pushing [=======>                                           ]  33.79kB/239.9kB

e9fed371e4cb: Pushing [=>                                                 ]     512B/19.68kB

e9fed371e4cb: Pushing [==================================================>]   21.5kB

21e2f1ba89b7: Pushing [======>                                            ]  33.79kB/249.3kB

388f8c5e98e9: Pushing [>                                                  ]     512B/29.8kB

388f8c5e98e9: Pushing [==================================================>]  32.26kB

6c48349df066: Pushing [====================>                              ]  99.33kB/239.9kB

5c9c39a7c3d2: Pushing [==================================================>]  66.05kB

21e2f1ba89b7: Pushing [===================>                               ]  99.33kB/249.3kB

6c48349df066: Pushing [=========================================>         ]  197.6kB/239.9kB

21e2f1ba89b7: Pushing [=======================================>           ]  197.6kB/249.3kB

6c48349df066: Pushing [==================================================>]  240.9kB

6c48349df066: Pushing [==================================================>]  242.2kB

21e2f1ba89b7: Pushing [==================================================>]  250.3kB

21e2f1ba89b7: Pushing [==================================================>]  251.4kB

How to reproduce

I've already added 4 different AWS policy permissions to allow the different needed ECR (docker) interactions:

What do you expect

How can I actually know which HTTP returned 403 to the plugin?

What happened instead

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:push (default-cli) on project ms-mailer: Exception caught: error parsing HTTP 403 response body: unexpected end of JSON input: "" -> [Help 1]

Software:

Full backtrace

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:push (default-cli) on project ms-mailer: Exception caught
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    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:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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:498)
    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: org.apache.maven.plugin.MojoExecutionException: Exception caught
    at com.spotify.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:151)
    at com.spotify.docker.PushMojo.execute (PushMojo.java:38)
    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:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    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:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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:498)
    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.DockerException: error parsing HTTP 403 response body: unexpected end of JSON input: ""
    at com.spotify.docker.client.AnsiProgressHandler.progress (AnsiProgressHandler.java:55)
    at com.spotify.docker.Utils$DigestExtractingProgressHandler.progress (Utils.java:172)
    at com.spotify.docker.client.ProgressStream.tail (ProgressStream.java:74)
    at com.spotify.docker.client.DefaultDockerClient.push (DefaultDockerClient.java:1274)
    at com.spotify.docker.client.DefaultDockerClient.push (DefaultDockerClient.java:1252)
    at com.spotify.docker.Utils.pushImage (Utils.java:91)
    at com.spotify.docker.PushMojo.execute (PushMojo.java:49)
    at com.spotify.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:149)
    at com.spotify.docker.PushMojo.execute (PushMojo.java:38)
    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:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    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:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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:498)
    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)
jjshoe commented 6 years ago

https://github.com/moby/moby/issues/19010#issuecomment-168715086

davidxia commented 6 years ago

Is this still an issue with the latest version?

steve-exley commented 6 years ago

Add ecr:BatchCheckLayerAvailability to the AWS permissions. It is required to enable push operations.

SyedAsadRazaDevops commented 3 years ago

I'M STILL LOOKING FOR THE SOLUTION , I'M USING AZURE ACR SERVICE

asad@linux:~/docker/asp.net/ASP-.NET-Core-Template$ az acr login --name myACRaccount

Uppercase characters are detected in the registry name. When using its server url in docker commands, to avoid authentication errors, use all lowercase. Login Succeeded

asad@linux:~/docker/asp.net/ASP-.NET-Core-Template$ docker push myregistry.azurecr.io/asadzoot/asp.netcoreimage Using default tag: latest

The push refers to repository [myregistry.azurecr.io/asadzoot/asp.netcoreimage] b370636613f1: Preparing 6c77a46d2383: Preparing 49c07c30337e: Preparing 927533446f60: Preparing 2f4f353cfbf4: Preparing 09fb0ecd67d7: Waiting d000633a5681: Waiting error parsing HTTP 403 response body: unexpected end of JSON input: ""