Luke
Luke

Reputation: 181

Uploading images with Google Jib to Docker hub private repository

I'm trying tu use Jib to create docker images. I created a settings.xml file with credentials to my docker hub, I login succesfully using Docker login and I see the image created. This is what I had in my pom:

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>${jib.version}</version>
    <configuration>
        <from>
            <image>eclipse-temurin:23.0.1_11-jre</image>
        </from>
        <to>
            <image>myaccountname/${project.artifactId}</image>
        </to>
        <container>
            <mainClass>org.springframework.boot.loader.JarLauncher</mainClass>
        </container>
    </configuration>
</plugin>

It was created a repository with name like the value of "${project.artifactId}"

Then I created a private repo (the only one you can create private with free plan) with name private-repo-test and changed pom:

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>${jib.version}</version>
    <configuration>
        <from>
            <image>eclipse-temurin:23.0.1_11-jre</image>
        </from>
        <to>
            <image>myaccountname/private-repo-test/${project.artifactId}</image>
        </to>
        <container>
            <mainClass>org.springframework.boot.loader.JarLauncher</mainClass>
        </container>
    </configuration>
</plugin>

Now, when I execute mvn clean compile jib:build I get this error: Build image failed, perhaps you should make sure your credentials for 'registry-1.docker.io/myaccountname/private-repo-test/imagename' are set up correctly.

I think the problem could be in repo structure. Before I created directly a repo with name, ${project.artifactId}, now I'm trying to create a repo with name ${project.artifactId} inside repo "private-repo-test". Am I right?

Which is the solution? How can I use Jib to create images (not only one, but lots because I need to create an image for ever microservice I have) in my private repo?

Thanks

Upvotes: 0

Views: 56

Answers (0)

Related Questions