I have a multimodule project with one parent and two children.
Parent pom looks like this :
(...)
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.4</version>
<relativePath>../parent-project</relativePath>
</parent>
<groupId>com.example</groupId>
<artifactId>parent-project</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<name>parent-project</name>
<modules>
<module>../child-1</module>
<module>../child-2</module>
</modules>
(...)
<build>
<defaultGoal>spring-boot:run</defaultGoal>
<directory>../parent-project/target</directory>
<sourceDirectory>../parent-project/src/main/java</sourceDirectory>
<testSourceDirectory>../parent-project/src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>../parent-project/src/main/resources</directory>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>${jib-maven-plugin.version}</version>
<configuration>
<from>
<image>${jib-maven-plugin.image}</image>
<platforms>
<platform>
<architecture>${jib-maven-plugin.architecture}</architecture>
<os>linux</os>
</platform>
</platforms>
</from>
<to>
<image>parent-project:latest</image>
</to>
<container>
<entrypoint>
<shell>bash</shell>
<option>-c</option>
<arg>/entrypoint.sh</arg>
</entrypoint>
<ports>
<port>8080</port>
</ports>
<environment>
<SPRING_OUTPUT_ANSI_ENABLED>ALWAYS</SPRING_OUTPUT_ANSI_ENABLED>
</environment>
<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
<user>1000</user>
</container>
<extraDirectories>
<paths>src/main/docker/jib</paths>
<permissions>
<permission>
<file>/entrypoint.sh</file>
<mode>755</mode>
</permission>
</permissions>
</extraDirectories>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
and child project looks like :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.4</version>
</parent>
<groupId>com.example</groupId>
<artifactId>child-1</artifactId>
<version>1.0.0</version>
<name>child-1</name>
(...)
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<configuration>
<!-- we don't want jib to execute on this module -->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
When I run ./mvnw clean package -Pprod verify jib:dockerBuild
the build succeed.
But When I check image (docker images
), there’s nothing.
And, when I run docker compose docker compose -f src/main/docker/app.yml up -d --wait
with
version: '3.8'
name: parent-project
services:
app:
image: parent-project
environment:
- _JAVA_OPTIONS=-Xmx512m -Xms256m
- SPRING_PROFILES_ACTIVE=prod
ports:
- "127.0.0.1:8080:8080"
I get
✘ app Error pull access denied for parent-project, repository does not exist or may require 'docker login': denied: requested access to the resource is denied 1.1s
Error response from daemon: pull access denied for parent-project, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Which seems to be expected, because I do not find any image.
I guess my problem comes from a jib misconfiguration, because I expect to have an image available after jib:dockerBuild
.
PS: I can run/debug locally from IntelliJ, everything works. Build is OK and tests too.
Which configuration am I missing in order to build my image ?
Thank’s a lot.