I am using io.fabric8
docker-maven-plugin
for building and pushing docker image to a registry hub.docker.com
. The image needs to be pushed on a repository (For eg. xyz) which lies under an organization (For eg. demo). This is my plugin from 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>
To push to the repo, your username should be registered with the organization. Now, the docker image build part is working fine but I am unable to push the image through docker:push
option. I read and tried other available solutions like using
<authConfig>
<username></username>
<password></password>
</authConfig>
and added registry name in .docker/.config
file but it didn't worked . I also added registry but it also didn't worked.
<registry>https://hub.docker.com</registry>
The push is working by using
docker push
But its not working with the plugin. Please help me. Thanks.