0

我尝试使用docker-maven-plugin 从 spotify推送 docker 映像

命令:

mvn deploy

或者也试过

mvn clean package docker:push

我的插件配置如下所示:

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>dockerfile-maven-plugin</artifactId>
    <version>${dockerfile-maven-plugin.version}</version>
    <configuration>
        <repository>${docker.image.prefix}/${project.artifactId}</repository>
        <tag>${docker.tag}</tag>
        <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
        <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
    </configuration>
</plugin>

特性:

<properties>
    <java.version>11</java.version>
    <dockerfile-maven-plugin.version>1.4.13</dockerfile-maven-plugin.version>
    <docker.tag>latest</docker.tag>
    <docker.image.prefix>myacrName.azurecr.io</docker.image.prefix>
    <java.version>1.8</java.version>
</properties>

我的错误日志是:

[ERROR] unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.848 s
[INFO] Finished at: 2022-02-10T20:19:29+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.13:push (default-cli) on project myaccount-service: Could not push image: unauthorized: authentication required, visit https://aka.ms/acr/authorization for m
ore information. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

只是为了确保我还在 settings.xml 中添加了汽车服务器,例如:

<servers>
    <server>
        <id>myacrName.azurecr.io</id>
        <username><SPN_ID></username>
        <password><SPN_PASSWORD></password>
    </server>
</servers>

我希望有人知道解决方案或可以指出我的方向

4

0 回答 0