Gitlab CI and Maven Fabric8 plugin

Currently, we use Fabric8 plugin to build and push Docker images.
The thing is, that this plugin utilizes Maven to build the project and Docker to push the images.
The command looks like this: “mvn clean package docker:build docker:push”.
We use Gitlab Ci to run our Maven builds, but the real goal is to get use of Fabric8 plugin within the .gitlab-ci.yml.
An attempt to just add the above command to .gitlab-ci.yml script section failed.
And the reason why is known: you need to use a correct image.
For example: if I use doker:stable image in .gitlab-ci.yml, I receive “/bin/sh: eval: line 80: mvn: not found”, and if I use image: maven:3-jdk-8, I receive
“/bin/sh: eval: line 80: docker: not found”.
Does the image, which combines Docker and Maven binaries, even exists?
Or, maybe, we just approaching the problem from the wrong end?

Also, it’s worth to mention, that I configured my runner as Docker from Docker by mounting corresponding volume (–docker-volumes /var/run/docker.sock:/var/run/docker.sock) to give access to the hosts’ socket.

Thanks in advance!

Attaching our .gitlab-ci.yml.

image: docker:stable

DOCKER_HOST: tcp://docker:2375/


  • Maven build

image: maven:3-jdk-8
stage: Maven build
- cd ./config-service
- mvn clean package docker:build docker:push

1 Like

Try running a docker-in-docker service alongside your maven build:

  - maven-build

        - name: docker-19.03-dind
    image: maven:3.6-jdk-8

    stage: maven-build
      - dnd
    script: |
        mvn clean package docker:build docker:push

In your pom.xml, you can configure the fabric8 plugin using environment variables that Gitlab provides:


I configure the above indirectly using different profiles, in order to support both local developer builds and gitlab-ci.


Thank you very much for the reply - will try this ASAP :slight_smile: