Skip to content

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

@oluwatimilehin

Description

@oluwatimilehin

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions