1. The base image of this image is: https://www.cnblogs.com/JoeyWong/p/9173265.html
2. Put the packaged project files in a directory similar to Dockerfile
3, Dockerfile as follows:
# Base OS image fromCentos:jdk8MaintainerJoey <your email>LABELDescription= "This image is Javaweb images." Version= "1.0"#java WebRUNmkdir/home/data# uploading project files locally to the mirrorADDjavaweb-package.zip/home/data# unzip the project and delete the extra files after decompressionRUNunzip/home/data/javaweb-package.zip-d/home/data/&& rm-rf/home/data/javaweb-package.zip #授权RUNChmod-r +x/home/data/javaweb-1.0#开放8080端口EXPOSE8080#在启动后执行web项目的启动脚本entrypoint["Sh", "/home/data/javaweb-1.0/start.sh"]
4. Note:
1, the project decompression path, at the beginning I did not extract the project to the specified path, and then the resulting image in the project was extracted to the/directory, so that the project is always running error
2. When I run the project startup script after the last boot, I use nohup in my script, running in the background, so the container will exit after Docker run!! So I added the tail-f $PRG _dir/log.log the command to view the log dynamically at the end of my start.sh script, and this is done!
5, create the image, note. It's important .
Docker build-t Javaweb:1.0 .
6. Export the image, where
Docker Save < Mirror id>>/root/javaweb-docker. Tar
Dockerfile Package Springboot small items, and export