title: Docker container run with error: Exception in thread "main" java.lang.ClassNotFoundException:
body: <p>I am doing build images:</p>
  <pre><code>docker build -t jkh9 .
  </code></pre>
  <p>and running container:</p>
  <pre><code>docker run jkh9
  </code></pre>
  <p>and get exception:</p>
  <pre><code>C:\Users\kulik\IdeaProjects\JkhPaymentTemplateService&gt;docker run jkh9
  Exception in thread &quot;main&quot; java.lang.ClassNotFoundException: ru.kulikovskiy.jkh.jkhpaymenttemplate
          at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
          at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
          at java.base/java.lang.Class.forName0(Native Method)
          at java.base/java.lang.Class.forName(Class.java:398)
          at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
          at org.springframework.boot.loader.Launcher.launch(Launcher.java:109)
          at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
          at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
  </code></pre>
  <p>this project success start from command line</p>
  <p><code>java -jar target\JkhPaymentTemplateService-1.0-SNAPSHOT.jar</code></p>
  <p>My DockerFile:</p>
  <pre><code>FROM maven:3.6.0-jdk-11-slim AS build
  ENV DB_HOST localhost
  ENV DB_PORT 2376
  COPY pom.xml /pom.xml
  RUN mvn -f pom.xml clean
  RUN mvn -f pom.xml install
  RUN mvn -f pom.xml package
  RUN mvn dependency:copy-dependencies
  
  FROM openjdk:11.0-jdk
  COPY --from=build /target/JkhPaymentTemplateService-1.0-SNAPSHOT.jar JkhPaymentTemplateService.jar
  EXPOSE 8081
  ENTRYPOINT [&quot;java&quot;,&quot;-jar&quot;,&quot;/JkhPaymentTemplateService.jar&quot;]
  CMD java -classpath JkhPaymentTemplateService
  </code></pre>
  <p>My pom.xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
           xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;org.example&lt;/groupId&gt;
      &lt;artifactId&gt;JkhPaymentTemplateService&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.3.3.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;start-class&gt;ru.kulikovskiy.jkh.jkhpaymenttemplate.JkhPaymentTemplateService&lt;/start-class&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
              &lt;version&gt;2.3.3.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jetty&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
              &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
              &lt;version&gt;42.2.16&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;version&gt;1.18.12&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.testcontainers&lt;/groupId&gt;
              &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
              &lt;version&gt;1.10.6&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.zonky.test&lt;/groupId&gt;
              &lt;artifactId&gt;embedded-database-spring-test&lt;/artifactId&gt;
              &lt;version&gt;1.5.2&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;mainClass&gt;ru.kulikovskiy.jkh.jkhpaymenttemplate&lt;/mainClass&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;descriptorRefs&gt;
                          &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                      &lt;/descriptorRefs&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;make-assembly&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;single&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;io.fabric8&lt;/groupId&gt;
                  &lt;artifactId&gt;docker-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;skip&gt;false&lt;/skip&gt;
  
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
                              &lt;mainClass&gt;ru.kulikovskiy.jkh.jkhpaymenttemplate.JkhPaymentTemplateService&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                      &lt;images&gt;
                          &lt;image&gt;
                              &lt;build&gt;
                                  &lt;entryPoint&gt;
                                      java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -cp
                                      '/maven/*' play.core.server.ProdServerStart
                                  &lt;/entryPoint&gt;
                              &lt;/build&gt;
                          &lt;/image&gt;
                      &lt;/images&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  <p>This project is</p>
  <p>and i get error.
  What should I change in pom or dockerfile?
  IDE - Intellage idea.</p>
  <p>UPD:
  I am change pom.xml, but but the error remained</p>
  <pre><code>   &lt;plugin&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;executions&gt;
              &lt;execution&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;repackage&lt;/goal&gt;
                  &lt;/goals&gt;
              &lt;/execution&gt;
          &lt;/executions&gt;
      &lt;/plugin&gt;
  </code></pre>