首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用spotify/dockerfile-maven-plugin推送docker集线器时出错

使用spotify/dockerfile-maven-plugin推送docker集线器时出错
EN

Stack Overflow用户
提问于 2017-12-13 00:13:16
回答 2查看 3.1K关注 0票数 7

我有一个maven项目,它是作为docker镜像构建的。我正在使用spotify/dockerfile-maven构建此镜像,并在mvn clean install上自动将其推送到docker.hub。build阶段顺利通过。但是在push上我有这样的错误:

代码语言:javascript
运行
复制
[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)
......

这是我的插件配置:

代码语言:javascript
运行
复制
     <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推送时,一切都正常工作。

Here我发现了类似的问题,但是添加docker-client v8.8.4的依赖项不会改变任何事情。

此外,this评论建议切换到1.3.3版本,但这对我不起作用。

对于这两种情况,我可以在日志中看到它推送到相同的存储库:

代码语言:javascript
运行
复制
The push refers to a repository [docker.io/my-login/my-image-name]
EN

回答 2

Stack Overflow用户

发布于 2020-02-01 01:43:49

<useMavenSettingsForAuth>true</useMavenSettingsForAuth>添加到配置标记中,并在maven settings.xml中将服务器凭据指定为-

代码语言:javascript
运行
复制
<server>
      <id>docker.io</id>
      <username>xxxxx</username>
      <password>xxxxxx</password>
    </server>
票数 3
EN

Stack Overflow用户

发布于 2021-01-09 13:00:30

我假设您不会收到一个错误,指出找不到docker.io服务器引用,这意味着您的settings.xml凭据是正确选择的。可能是${docker.image.prefix}不是正确的hub.docker.com用户名。试着对它进行硬编码,看看它是否有效。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47776984

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档