Hi,
I am using jib to create an image and push it in the gitlab registry or docker hub registry. I would like to share with you my problem.
In the CI, I have the following settings:
build:
stage: build
image: maven:latest
variables:
DOCKER_CONFIG: $PWD/.docker/config.json
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Djava.awt.headless=true"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
script:
- env | sort
- id
- mvn ${MAVEN_CLI_OPTS} -Djib.id=${CI_REGISTRY} -Djib.auth.user=gitlab-ci-token -Djib.auth.password=${CI_TOKEN_PASSWORD} -e -X clean package jib:build
Inside the project I have the file settings.xml:
<settings>
<servers>
<server>
<id>${env.CI_REGISTRY}</id>
<username>gitlab-ci-token</username>
<password>${env.CI_TOKEN_PASSWORD}</password>
</server>
</servers>
</settings>
Inside the project I also have .docker/config.json with the following settings:
{
"auths": {
"registry.gitlab.com": {
"auth": ${CI_TOKEN_PASSWORD}
},
"HttpHeaders": {
"User-Agent": "Docker-Client/19.03.3 (linux)"
}
}
In the pom.xml file I have:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>${jib-maven-plugin.version}</version>
<configuration>
<to>
<image>joda70/${project.artifactId}:${project.version}</image>
</to>
</configuration>
</plugin>
In my local working directory, I am able to create and push image with jib:build on docker.hub.
The main difference with this setup is that on my local machine I have docker client installed.
Do I have to install docker client on the maven image?
Best regards
Elisabetta