1. First use docker to start the jar project and report an error
Because the code running in the container reported an error, and the container Exited (1) 3 seconds ago , you can see what went wrong through docker logs -f container_id
2. See the error message is no main manifest attribute
The solution is: add in the pom.xml file
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
</build>
3. Re-run
docker run -it -d -p 8080:8080-v /home/wms.jar:/home/wms.jar --name wms codenvy/jdk8_maven3_tomcat8 java -jar /home/wms.jar
-v /home/wms.jar:/home/wms.jar host and container mapping
Mirror name of codenvy/jdk8_maven3_tomcat8 jdk
java -jar /home/wms.jar starts the jar package in the container