我无法使用 fabric8 插件将 docker映像推送到私有存储库(托管在https://hub.docker.com上)。我在 hub.docker 上创建了一个名为: 的存储库manuzid/heap-dump-sample
。这是一个简单的 Spring Boot 应用程序,仅在 main 函数中有一个循环。有趣的部分是 pom.xml 中的以下内容:
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.27.2</version>
<configuration>
<registry>index.docker.io/v1</registry>
<!-- I think it's not necessary, plugin use the creds from docker config.json -->
<authConfig>
<username>user</username>
<password>pw</password>
</authConfig>
<images>
<image>
<name>manuzid/heap-dump-sample:%l</name>
<alias>${project.artifactId}</alias>
<build>
<from>greyfoxit/alpine-openjdk8</from>
<entryPoint>
<exec>
<arg>java</arg>
<arg>-jar</arg>
<arg>/opt/application/${project.artifactId}-${project.version}.jar</arg>
<arg>-XX:+HeapDumpOnOutOfMemoryError</arg>
<arg>-XX:HeapDumpPath=/dumps/oom.hprof</arg>
</exec>
</entryPoint>
<tags>
<tag>${project.version}</tag>
</tags>
<assembly>
<targetDir>/opt/application</targetDir>
<descriptorRef>artifact</descriptorRef>
</assembly>
<env>
<AB_ENABLED>jmx_exporter</AB_ENABLED>
</env>
</build>
<run>
<wait>
<log>Started HeapDumpSampleApplication</log>
<time>10000</time>
</wait>
<env>
<JAVA_OPTIONS>-Xmx64m</JAVA_OPTIONS>
</env>
<log>
<file>${project.build.directory}/heap-dump-sample.log</file>
</log>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>docker-build</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
<configuration>
<filter>${project.artifactId}</filter>
</configuration>
</execution>
<execution>
<id>docker-push</id>
<phase>install</phase>
<goals>
<goal>push</goal>
</goals>
<configuration>
<filter>${project.artifactId}</filter>
</configuration>
</execution>
</executions>
</plugin>
我在控制台中收到以下错误:[ERROR] DOCKER> Unable to push 'manuzid/heap-dump-sample:latest' from registry 'index.docker.io/v1' : denied: requested access to the resource is denied [denied: requested access to the resource is denied ]
但指定的凭据与我用于登录网站 ( https://hub.docker.com ) 的凭据相同。index.docker.io/v1
使用命令获取指定的注册表 url docker info
。
对此有何建议?提前致谢。
编辑:这个例子可以在这里找到:https ://github.com/ManuZiD/heap-dump-sample