- 准备jar包
mvn clean package spring-boot:repackage
- Dockerfile
FROM openjdk:8-jre WORKDIR / RUN mkdir -p /usr/local/files/upload ADD ymq-1.0-SNAPSHOT.jar ymq-1.0-SNAPSHOT.jar EXPOSE 8000 CMD java -Djava.security.egd=file:/dev/./urandom -jar /ymq-1.0-SNAPSHOT.jar
- make docker image
docker build -t ymq:0.0.1 .
- run
docker run -dp 8000:8000 -v /usr/local/files/upload:/usr/local/files/upload $image_id
- 查看日志
docker logs -f $container_id