Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better error message for docker:push if you don't specify -Ddocker.username / -Ddocker.password system properties, autoConfig or have a missing <server><id> value #43

Closed
jstrachan opened this issue Nov 12, 2014 · 5 comments
Milestone

Comments

@jstrachan
Copy link
Contributor

I was getting quite confused trying to figure out why the push wasn't working. I kept getting the errors shown below.

Turns out adding -Ddocker.username=jolokia -Ddocker.password=jolokia to the CLI fixed it. (Thanks for figuring that out @iocanel!).

I wonder if the plugin could do a big warning if the system properties are not specified and a server id (of the registry host:port) is not available; so new users grok what they need to do.

e.g. if there's no authConfig values and no system properties for docker.username / docker.password and no ~/.m2/settings.xml we should fail the build and output a big warning telling folks to add an authConfig, set the system properties or add something like this to their ~/.m2/settings.xml:

       <server>
           <id>192.168.59.103:5000</id>
           <username>jolokia</username>
           <password>jolokia</password>
       </server>

then lots of users who just see this error will thank you ;)

INFO] --- docker-maven-plugin:0.9.12:build (default-cli) @ fabric8-mq ---
[INFO] Copying files to /workspace/java/fabric8-quickstarts/apps/fabric8-mq/target/docker/maven
[INFO] Building tar: /workspace/java/fabric8-quickstarts/apps/fabric8-mq/target/docker-tmp/docker-build.tar
[INFO] DOCKER> Created data image 192.168.59.103:5000/fabric8/fabric8-mq:2.0-SNAPSHOT
[INFO]
[INFO] --- docker-maven-plugin:0.9.12:push (default-cli) @ fabric8-mq ---
[INFO] Copying files to /workspace/java/fabric8-quickstarts/apps/fabric8-mq/target/docker/maven
[INFO] Building tar: /workspace/java/fabric8-quickstarts/apps/fabric8-mq/target/docker-tmp/docker-build.tar
[INFO] DOCKER> Created data image 192.168.59.103:5000/fabric8/fabric8-mq:2.0-SNAPSHOT
[WARNING] DOCKER> Couldn't parse answer chunk 'EOF
': org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.221s
[INFO] Finished at: Wed Nov 12 14:59:41 GMT 2014
[INFO] Final Memory: 39M/366M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jolokia:docker-maven-plugin:0.9.12:push (default-cli) on project fabric8-mq: Error while pushing image '192.168.59.103:5000/fabric8/fabric8-mq:2.0-SNAPSHOT' (code: 500, Internal Server Error) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jolokia:docker-maven-plugin:0.9.12:push (default-cli) on project fabric8-mq: Error while pushing image '192.168.59.103:5000/fabric8/fabric8-mq:2.0-SNAPSHOT' (code: 500, Internal Server Error)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    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:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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: Error while pushing image '192.168.59.103:5000/fabric8/fabric8-mq:2.0-SNAPSHOT' (code: 500, Internal Server Error)
    at org.jolokia.docker.maven.AbstractDockerMojo.execute(AbstractDockerMojo.java:87)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Error while pushing image '192.168.59.103:5000/fabric8/fabric8-mq:2.0-SNAPSHOT' (code: 500, Internal Server Error)
    at org.jolokia.docker.maven.access.DockerAccessUnirest.processChunkedResponse(DockerAccessUnirest.java:547)
    at org.jolokia.docker.maven.access.DockerAccessUnirest.processPullOrPushResponse(DockerAccessUnirest.java:467)
    at org.jolokia.docker.maven.access.DockerAccessUnirest.pullOrPushImage(DockerAccessUnirest.java:264)
    at org.jolokia.docker.maven.access.DockerAccessUnirest.pushImage(DockerAccessUnirest.java:251)
    at org.jolokia.docker.maven.PushMojo.executeInternal(PushMojo.java:23)
    at org.jolokia.docker.maven.AbstractDockerMojo.execute(AbstractDockerMojo.java:85)
    ... 21 more
[ERROR]
@jstrachan jstrachan changed the title better error message for docker:push if you don't specify -Ddocker.username / -Ddocker.password system properties better error message for docker:push if you don't specify -Ddocker.username / -Ddocker.password system properties, autoConfig or have a missing <server><id> value Nov 12, 2014
@rhuss
Copy link
Collaborator

rhuss commented Nov 13, 2014

Yeah, you are right. Going to add this ASAP for the next release.

@rhuss rhuss added this to the 0.10.5 milestone Nov 13, 2014
@rhuss rhuss modified the milestones: 0.10.6, 0.10.5 Dec 5, 2014
@jgangemi
Copy link
Collaborator

just realized this and #102 are related, if not the same thing.

@rhuss
Copy link
Collaborator

rhuss commented Mar 1, 2015

Still have to verify this, moving it to the 0.11.3 list.

@rhuss rhuss modified the milestones: 0.11.3, 0.11.0 Mar 1, 2015
@jgangemi
Copy link
Collaborator

jgangemi commented Mar 1, 2015

this still exists but as i said somewhere (#102 i think), i'm not sure how we would know to give a better error message for the docker failure.

i think part of the solution could be to check if it's a private repository (not docker hub) and if yes and no auth config is specified, send one w/ using blank strings as the encoded values. the docker cli must do some form of this b/c i can push to private repos w/o any issue.

@rhuss rhuss modified the milestones: 0.11.3, 0.11.4 Apr 21, 2015
@rhuss rhuss modified the milestones: 0.12.0, 0.11.4 May 15, 2015
@rhuss
Copy link
Collaborator

rhuss commented May 18, 2015

With the latest version of Docker/plugin, I get the following error message if authentication fails:

[INFO] --- docker-maven-plugin:0.11.5-M1:push (default-cli) @ docker-jolokia-demo ---
[INFO] DOCKER> ... The push refers to a repository [registry.hub.docker.com/jolokia/docker-jolokia-demo] (len: 1)
[INFO] DOCKER> ... Sending image list
[ERROR] DOCKER> Authentication is required.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

I don't know what happened in the meantime, but I hope that's clear enough ;-)

@rhuss rhuss closed this as completed May 18, 2015
leusonmario pushed a commit to leusonmario/docker-maven-plugin that referenced this issue Aug 18, 2018
BuildMojo - imageTags parameter added to tag an image with additional tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants