testcontainers / testcontainers/testcontainers-jooq-codegen-maven-plugin

How do I get this to run in my docker build stage?

Open
#30 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
70
Forks
22
PR merge metrics
No merged PRs in 30d

Description

I have a Dockerfile that does a multistage build where the build stage looks like:

#
# Build stage
#
FROM maven:3.9.1-eclipse-temurin-17 AS build
WORKDIR /app
COPY src ./src
COPY pom.xml .

RUN --mount=type=cache,target=/root/.m2 mvn clean package

This fails when it runs mvn clean package with the error:

#0 3.561 [INFO] Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
#0 3.876 [INFO] docker-machine executable was not found on PATH ([/opt/java/openjdk/bin, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin])
#0 3.876 [ERROR] Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
#0 3.876        UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
#0 3.876        DockerDesktopClientProviderStrategy: failed with exception NullPointerException (Cannot invoke "java.nio.file.Path.toString()" because the return value of "org.testcontainers.dockerclient.DockerDesktopClientProviderStrategy.getSocketPath()" is null)As no valid configuration was found, execution cannot continue.

I understand that we need a valid docker daemon and there's none in the build stage, but I'm wondering if there's a workaround or maven flag I can specify to generate the sources without starting the container in the build stage. Any pointers on this, please?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Dockerfile build stage and pom.xml, then reproduce the failure by running mvn clean package with the shown cache mount. Trace how the plugin handles source generation when no Docker daemon is available; done means establishing a supported way to generate sources during the build stage or documenting that it cannot be done.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
build-system, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.