Issue with docker run

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
COPY ./target/gen-test9-0.0.1-SNAPSHOT.jar /app/gen-test9.jar
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.

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.

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


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.