Right, it’s a MySQL server image and won’t contain a JVM.
As a general rule, if Docker gives an error message like “command not found” or “no such file or directory”, it means exactly what it says. It’s often helpful to do things like docker run --rm -it imagename /bin/sh to get a shell and see what exactly is inside the container.
(It sort of looks like you’re trying to squish two images together: Dockerfile2 builds two images, the first is just a copy of the standard java:8 container and the second is a MySQL image plus a jar file. You can’t do that. You should run the database server in a separate container from your application; Docker Compose is a good tool for running the two containers together.)
(Also, ADD will unpack things that look like tar or zip files. Java jar files are actually zip files, and ADD will unpack them. This often isn’t what you want. Usually, unless you really explicitly want the automatic unpacking, you should almost always use COPY instead of ADD.)
Thanks for your answer. Using docker-compose, I could run mysql server and java application. but now I ended up in new issue. The application is working fine on my computer, but when I port to docker and run, i face this error.
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]