Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

unable to push to docker hub from plugin although i can push using docker push #51

Closed
ahmedabbas11 opened this issue Jul 20, 2017 · 13 comments
Labels

Comments

@ahmedabbas11
Copy link

I have the following configuration in pom.xml

 <build>
    <plugins>
        <plugin>
            <groupId>com.spotify</groupId>
            <artifactId>dockerfile-maven-plugin</artifactId>
            <version>1.3.4</version>
            <executions>
          <execution>
            <id>build</id>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
          <execution>
            <id>tag</id>
            <goals>
              <goal>tag</goal>
            </goals>
            <configuration>
              <repository>DOCKER_HUB_ACCOUNT/euraka-service</repository>x
            </configuration>
          </execution>
        </executions>
        </plugin>
    </plugins>
</build>

when i : sudo run mvn clean package , everything is ok
but when i run : sudo mvn dockerfile:push

i get the following error:

[INFO] --- dockerfile-maven-plugin:1.3.4:push (default-cli) @ eureka-service ---
[INFO] The push refers to a repository [docker.io/DOCKER_HUB_ACCOUNT/euraka-service]
[INFO] Image 9f41bdcbb175: Preparing
[INFO] Image a77c3bad0c4f: Preparing
[INFO] Image 8ed4ebdc2a2b: Preparing
[INFO] Image 2fd640341bb9: Preparing
[INFO] Image 5bef08742407: Preparing
[ERROR] denied: requested access to the resource is denied
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not push image
at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:90)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:227)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:216)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
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:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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: denied: requested access to the resource is denied

when i run : sudo docker push DOCKER_HUB_ACCOUNT/euraka-service
the image is push to docker hub successfully
this happens whether the repo is public or private

@lipengbin
Copy link

Ihave the same error!

@lipengbin
Copy link

I have built a image。
It's showing in docker local repository.
I can push the image to private repository by docker push command.
But,can't push the image by maven cmd.

@jlyheden
Copy link

Same issue here when pushing to Artifactory, revert to version 1.3.3 of the plugin solved it.

@dbeaumont
Copy link

dbeaumont commented Sep 14, 2017

I have the same issue on my mac (dockerfile-maven-plugin version 1.3.5)
Pushing on a public or private repo doesn't work.
Reverting to version 1.3.3 doesn't work.
For mac users, it might be releated to the new keychain credentials support in docker client (mine is 17.06.2-ce) : spotify/docker-client#657

@adamszadkowski
Copy link

The same issue here

@mnoky
Copy link

mnoky commented Nov 21, 2017

I had the same issue with version 1.3.6 and was able to fix this by following the advice from user robege found in issue 79. Basically, change the docker-client dependency to 8.8.4

@DominiqueComte
Copy link

solved a (similar, I think) issue by using useMavenSettingsForAuth=true and adding a server with id docker.io in my ~/.m2/settings.xml file

@SeriyBg
Copy link

SeriyBg commented Dec 13, 2017

I have the same issue with version 1.3.6. I have described it here. Has anyone solved it?

@victal
Copy link

victal commented Dec 27, 2017

I had the same problem recently, tried every version from 1.3.2 to 1.3.7 with and without changing the docker-client version as suggested above and nothing worked.

In my case, it seems that the problem happened because I had a question mark in my password (haven't tried with other special chars) - after changing passwords to a string of the same size with only letters and numbers mvn dockerfile:push started working, and after changing back the command stopped working again.

I'll try to do a couple more tests to check if the problem is on the plugin or the docker api, and if useMavenSettingsForAuth=true solves the problem as well

EDIT: After a couple more tests, the problem I had happens only when the image I'm trying to push depends on a private image (i.e. with FROM myuser/myprivateimage on the Dockerfile) but I'm not sure if the problem lies on the plugin, docker-client or the docker api itself

@SimonKlausLudwig
Copy link

Same issue with dockerhub

@khajapm
Copy link

khajapm commented Apr 11, 2018

Same issue while image push to private registry using maven spotify plugin
Failed to execute goal com.spotify:docker-maven-plugin:0.4.11:push (push-image) on project abc : Exception caught: denied: requested access to the resource is denied

Do have the registry server configured in maven settings.xml. Not sure whats missing.

@jose-lpa
Copy link

jose-lpa commented Jul 7, 2018

If anyone minds... I've got it working by login first to Dockerhub, and then pushing:

  1. docker login (insert your username and password...)
  2. mvn dockerfile:push

For more info, I didn't have any ~/.dockercfg or ~/.docker/config.json in my local, unlike is specified in the documentation.

Dockerfile-maven plugin version I use is 1.3.7.

@stale
Copy link

stale bot commented Sep 24, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests