项目名称
x-schools-server
部署教程
cd /app/webapps/x-schools-server
# 全部移除
cd /app/webapps/x-schools-server
docker stop $(docker ps -aqf "name=x-schools-server")
docker rm $(docker ps -aqf "name=x-schools-server")
docker rmi $(docker images -q x-schools-server )
# 重新部署
cd /app/webapps/x-schools-server
docker build -t x-schools-server -f /app/webapps/x-schools-server/Dockerfile /app/webapps/x-schools-server
docker run -d --restart=always --name x-schools-server -v /usr/local/apps/x-schools-server/logs:/app/webapps/x-schools-server/logs -p 13001:13001 x-schools-server
docker ps
# 查看启动日志
docker logs --tail 300 -f x-schools-server
Dockerfile 文件
FROM openjdk:8u102-jdk
VOLUME /tmp
ENV spring.profiles.active=dev
ENV server.port=10031
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
ADD x-schools-server-0.0.1.jar app.jar
RUN bash -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
- ENV spring.profiles.active=dev # 定义spring项目运行方式 dev prod 等
- ENV server.port=10031 # 定义spring项目运行端口
出处:http://www.cnblogs.com/sopcce/
本文版权归作者和博客园共有,欢迎转载,但必须给出原文链接,并保留此段声明,否则保留追究法律责任的权利。
嗨,如果有问题可以加QQ:1058848735 询问的哦,技术的道路上,求知求解共同探讨