fabric8:docker-maven-plugin cannot load the ffi provider when running on Centos7 in Jenkins

3.7k Views Asked by At

After adding fabric8 to a hello world pom, when running maven "clean install" in Jenkins on CentOS7,

            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.31.0</version>
                <configuration>
                    <filter>${*}</filter>
                    <images>
                        <image>
                            <name>docker.io/myname/${project.artifactId}:${project.version}</name>
                        </image>
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin> 

I get the following error

[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.31.0:build (default) on project reference-service: Execution default of goal io.fabric8:docker-maven-plugin:0.31.0:build failed: An API incompatibility was encountered while executing io.fabric8:docker-maven-plugin:0.31.0:build: java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>io.fabric8:docker-maven-plugin:0.31.0

...

[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: could not get native definition for type: POINTER: java.lang.UnsatisfiedLinkError: /tmp/jffi5159674609596634370.so: /tmp/jffi5159674609596634370.so: failed to map segment from shared object: Operation not permitted

I can't find any install instructions of a .so file for CentOS7 or other instructions.

The GitHub site doesn't provide much guidance;

Docker is listening on 2375 and docker.sock. The user I'm building as is in dockerroot.

Same issue with fuse

[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.23.0.fuse-730010-redhat-00001:build (default) on project reference-service: Execution default of goal io.fabric8:docker-maven-plugin:0.23.0.fuse-730010-redhat-00001:build failed: An API incompatibility was encountered while executing io.fabric8:docker-maven-plugin:0.23.0.fuse-730010-redhat-00001:build: java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
[ERROR] realm =    plugin>io.fabric8:docker-maven-plugin:0.23.0.fuse-730010-redhat-00001
2

There are 2 best solutions below

0
On

There are two options:

  • Easy one: upgrade to the last version of the plugin. The problem was resolved in release 0.38.1

https://github.com/fabric8io/docker-maven-plugin/releases/tag/v0.38.1

  • More complex one (If you can upgrade your plugin version): follow this tutorial m1 chip + f8-plugin problem. Is a combination of socat and DOCKER_HOST
0
On

In this case, FFI error meant that the plugin could not talk to the docker daemon. Setting DOCKER_HOST to tcp://127.0.0.1:2375 in the global jenkins config resolved my issue.