打包的时候出现错误:
d4fc045c9e3a: Preparing
[ERROR] DOCKER> Unable to push 'visatrack-service:0.0.5-SNAPSHOT' to registry 'repo-docker.isharkfly.com/docker-hub' : no basic auth credentials [no basic auth credentials ]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 59.332 s
[INFO] Finished at: 2024-05-24T23:22:17-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.44.0:push (default) on project api: Unable to push 'visatrack-service:0.0.5-SNAPSHOT' to registry 'repo-docker.isharkfly.com/docker-hub' : no basic auth credentials -> [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
PS D:\WorkDir\iSharkFly\USVisaTrack\Source-Code\Services\Visa-Isharkfly-Service>
错误的信息如上 的内容。
问题和解决
上面的问题原因是 pushRegistry 的配置不正确。
我们使用了仓库中的下级目录。
<pushRegistry>repo-docker.isharkfly.com/docker-hub</pushRegistry>
需要上面把上面的参数修改为:
<pushRegistry>repo-docker.isharkfly.com</pushRegistry>
不能使用下级目录,只使用根目录才可以。