22021987
(22021987)
1
Hello there,
I am trying to run docker after building the image, however, I could not run it.
My application (Java) uses the Test container - MySQL.
This is the Dockerfile:
FROM openjdk:17-jdk-slim
WORKDIR /app
COPY ./target/gen-test9-0.0.1-SNAPSHOT.jar /app/gen-test9.jar
EXPOSE 8088
ENTRYPOINT ["java","-jar","gen-test9.jar"]
After that, I run with the command:
docker run -it --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -e TESTCONTAINERS_RYUK_DISABLED=true -p 8080:8080 gen-test9:latest
I got an error:
How can I fix this issue, pls help me.
Thanks
It seems your container Java app is using Docker API to work with Docker MySQL.
Not sure what your app is doing, you would need to provide more details.
22021987
(22021987)
3
Thanks for replying to me. In this case, my application (Java) started using the Test container (MySQL) instead of using MySQL locally.
You can see the lib in the POM.xml file
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
</dependency>
This is the image that I ran this application with the command: ./mvnw → It works well
However, I tried to build a docker image and run on it and got an error.