Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
oluwatimilehin opened this issue Aug 17, 2023 · 3 comments
Open

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

oluwatimilehin opened this issue Aug 17, 2023 · 3 comments

Comments

@oluwatimilehin
Copy link

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?

@romchellis
Copy link
Contributor

Hi @oluwatimilehin
not sure that issue is related to this particullar project. but have you tried different base docker image which allows docker in docker?

@oluwatimilehin
Copy link
Author

@romchellis Hey, thanks for getting back to me. I think it could be good if there was an option to generate the sources without running test containers, but maybe that's not realistic. What do you think?

I've read that docker in docker is not the best idea, but I'll look into that further.

@eddumelendez
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants