Skip to content

[Bug]: Docker TestContainer failure with Linux Mint 21+ #10094

@tmulle

Description

@tmulle

Module

MariaDB

Testcontainers version

1.20.4 - Included in Quarkus 3.19.2

Using the latest Testcontainers version?

Yes

Host OS

Linux Mint 21 and 22

Host Arch

x86_64

Docker version

It's in the ticket info

What happened?

Describe the bug

A member of our team is getting a strange Docker/Testcontainer error when trying to run mvn quarkus:dev and letting the DevServices start up the DB.

We are using Quarkus and their DevServices and I filed a bug with them originally but they told me to file here instead and they closed my ticket.

Basically, the error is this:

Checking Docker Environment 09:35:03 INFO  [or.te.DockerClientFactory] (build-57) Testcontainers version: 1.20.4 {}
Tests paused
09:35:04 INFO  [or.te.im.PullPolicy] (build-57) Image pull policy will be performed by: DefaultPullPolicy() {} terminal, [h] for more options>O09:35:04 INFO  [or.te.ut.ImageNameSubstitutor] (build-57) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor') {}
09:35:04 INFO  [or.te.DockerClientFactory] (build-57) Testcontainers version: 1.20.4 {}
2025-03-13 09:35:04,307 INFO  [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2025-03-13 09:35:04,650 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor#launchDatabases threw an exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy$LibC
    at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.startDevDb(DevServicesDatasourceProcessor.java:369)
    at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.launchDatabases(DevServicesDatasourceProcessor.java:121)
    at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
    at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
    at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
    at java.base/java.lang.Thread.run(Thread.java:840)
    at org.jboss.threads.JBossThread.run(JBossThread.java:499)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy$LibC
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy.lambda$null$0(RootlessDockerClientProviderStrategy.java:37)
    at java.base/java.util.Optional.orElseGet(Optional.java:364)
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy.lambda$resolveSocketPath$1(RootlessDockerClientProviderStrategy.java:36)
    at java.base/java.util.Optional.orElseGet(Optional.java:364)
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy.resolveSocketPath(RootlessDockerClientProviderStrategy.java:33)
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy.getSocketPath(RootlessDockerClientProviderStrategy.java:29)
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy.isApplicable(RootlessDockerClientProviderStrategy.java:82)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
    at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602)
    at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
    at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
    at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:264)
    at org.testcontainers.DockerClientFactory.getOrInitializeStrategy(DockerClientFactory.java:154)
    at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:196)
    at org.testcontainers.DockerClientFactory$1.getDockerClient(DockerClientFactory.java:108)
    at com.github.dockerjava.api.DockerClientDelegate.authConfig(DockerClientDelegate.java:109)
    at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:321)
    at io.quarkus.devservices.mariadb.deployment.MariaDBDevServicesProcessor$1.startDatabase(MariaDBDevServicesProcessor.java:81)
    at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.startDevDb(DevServicesDatasourceProcessor.java:295)
    ... 11 more
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: Unable to load library 'c': /lib/x86_64-linux-gnu/libc.so: invalid ELF header [in thread "build-57"]
    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:145)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:188)
    at com.sun.jna.Library$Handler.<init>(Library.java:123)
    at com.sun.jna.Native.loadLibrary(Native.java:255)
    at com.sun.jna.Native.loadLibrary(Native.java:241)
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy$LibC.<clinit>(RootlessDockerClientProviderStrategy.java:96)
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy.lambda$null$0(RootlessDockerClientProviderStrategy.java:37)
    at java.base/java.util.Optional.orElseGet(Optional.java:364)
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy.lambda$resolveSocketPath$1(RootlessDockerClientProviderStrategy.java:36)
    at java.base/java.util.Optional.orElseGet(Optional.java:364)
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy.resolveSocketPath(RootlessDockerClientProviderStrategy.java:33)
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy.getSocketPath(RootlessDockerClientProviderStrategy.java:29)
    at org.testcontainers.dockerclient.RootlessDockerClientProviderStrategy.isApplicable(RootlessDockerClientProviderStrategy.java:82)

This is the Docker info:

Client: Docker Engine - Community
 Version:    28.0.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.21.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.33.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 7
  Running: 5
  Paused: 0
  Stopped: 2
 Images: 5
 Server Version: 28.0.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc version: v1.2.4-0-g6c52b3f
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-130-generic
 Operating System: Linux Mint 21.3
 OSType: linux
 Architecture: x86_64
 CPUs: 20
 Total Memory: 31.06GiB
 Name: mleber
 ID: 9ab17560-1176-42fe-8d4a-7d897c420c30
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

NOTE:
I just recreated the same error on a brand new install of Linux Mint 22 with docker and trying to use DevServices it falls over on starting up the MariaDB

Linux Mint is showing that particular file as TEXT:
file /lib/x86_64-linux-gnu/libc.so => /lib/x86_64-linux-gnu/libc.so: ASCII text

Catting the file shows:

Image

I have no trouble on Fedora (native docker) or MacOS w/Docker Desktop
Docker was installed via these steps which work perfectly and docker itself run fine.

https://linuxiac.com/how-to-install-docker-on-linux-mint-22/

Relevant log output

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions