我正在使用fabric8-maven-plugin在运行于Google Cloud平台上的Jenkins上构建Docker镜像。
这个插件提供了将镜像推送到Docker注册表的功能,但我不能让它与Google Container Registry一起工作,因为它不能进行身份验证。
在我的Jenkins管道中,我可以使用GCloudBuildWrapper和gcloud docker -- push很好地访问注册表。
为了访问Docker注册表,AWS插件可以与凭证或extended authentication一起使用,但这似乎只适用于fabric8。
那么,使用Docker插件将fabric8镜像推送到Google Container Registry中是完全可能的吗?
发布于 2017-11-19 22:08:52
找到了我的问题in the docs for Google Container Registry的解决方案。这个页面提供了两种方法: Docker credential helper,不幸的是我无法使用它,以及using an access token。
对于访问令牌方法,您使用'oauth2accesstoken‘作为GCR的用户名,并使用gcloud auth application-default print-access-token生成的令牌作为密码。不是很漂亮,但很有效。
发布于 2019-09-26 04:43:01
在奥托解决方案的基础上构建:
您需要在~/.m2/settings.xml中指定
<server>
<id>gcr.io/<!--your-registry--></id>
<username>oauth2accesstoken</username>
<password><!-- gcloud oauth token goes here --></password>
</server>然后,当您在pom.xml中通过id引用此注册表时,它将自动登录。
您必须使用oauth2accesstoken作为用户名。
https://stackoverflow.com/questions/47203688
复制相似问题