我有一个构建为 docker 映像的 maven 项目。我正在使用spotify/dockerfile-maven构建此映像并将其自动推送到 docker.hub on on mvn clean install
。该build
阶段顺利通过。但是push
我有这个错误:
[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)
........
Caused by: com.spotify.docker.client.exceptions.DockerException: denied: requested access to the resource is denied
at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError(LoggingProgressHandler.java:105)
at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress(LoggingProgressHandler.java:63)
......
这是我的插件配置:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<configuration>
<repository>${docker.image.prefix}/${project.artifactId}-istio</repository>
<tag>latest</tag>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
当docker push image-name:tag
一切正常时。
在这里我发现了类似的问题,但是添加依赖项docker-client v8.8.4
并没有改变任何东西。
此外,此评论建议切换到1.3.3
版本,但这对我不起作用。
对于这两种情况,我可以在日志中看到它推送到同一个存储库:
The push refers to a repository [docker.io/my-login/my-image-name]