![](/img/trans.png)
[英]openshift private docker registry Unable to push [docker-maven-plugin]
[英]Unable to push image on docker hub using maven plugin
我正在使用io.fabric8
docker-maven-plugin
构建并推送hub.docker.com
镜像到注册表hub.docker.com
。 需要将映像推送到位于组织(例如demo )下的存储库(例如xyz )上。 这是我来自pom.xml
插件。
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.20.1</version>
<configuration>
<images>
<image>
<name>demo/xyz:${tag}</name>
<build>
<dockerFileDir>${project.basedir}/docker</dockerFileDir>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>docker-image-build</id>
<phase>pre-integration-test</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>docker-image-push</id>
<phase>post-integration-test</phase>
<goals>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
要推送到仓库,您的用户名应在组织中注册。 现在,泊坞窗映像构建部分工作正常,但我无法通过docker:push
选项推送映像。 我阅读并尝试了其他可用的解决方案,例如使用
<authConfig>
<username></username>
<password></password>
</authConfig>
并在.docker/.config
文件中添加了注册表名称,但没有成功。 我还添加了注册表,但是它也没有起作用。
<registry>https://hub.docker.com</registry>
推送正在通过使用
码头工人推
但是它不能与插件一起使用。 请帮我。 谢谢。
我们正在使用com.spotify docker-maven-plugin
我认为它们没有太大的不同。
这是我们pom.xml
的示例
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.3</version>
<configuration>
<imageName>MY_REGISTRY:443/${project.artifactId}</imageName>
<imageTags>
<imageTag>latest</imageTag>
</imageTags>
<dockerDirectory>docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<serverId>MY-REGISTRY</serverId>
<registryUrl>https://MY_REGISTRY:443/v2/</registryUrl>
</configuration>
<executions>
<execution>
<id>docker-build</id>
<phase>install</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
注册表的用户名和密码在settings.xml
这是我们的settings.xml
的示例
<server>
<id>MY-REGISTRY</id>
<username>my-user</username>
<password>my-password</password>
<configuration>
<email>developer@my-company.com</email>
</configuration>
</server>
我希望这可以帮助您为您的项目获得正确的配置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.