Dockerfile文件
FROM openjdk:8-jdk-alpine
ARG JAVA_OPTS
ENV JAVA_OPTS=$JAVA_OPTS
VOLUME /app
WORKDIR /app
EXPOSE 80 #设置需要暴露的端口
ADD *****.jar /app/*****.jar
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
ENTRYPOINT exec java $JAVA_OPTS -jar -Duser.timezone=GMT+08 /app/******.jar
bash运行脚本
#!/bin/bash
docker rm -f container_name
docker run -itd
--name nginx
-p 80:80
-v ~/nginx/www:/usr/share/nginx/html
-v ~/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
-v ~/nginx/logs:/var/log/nginx nginx
-v ~/nginx/conf/nginx.conf:/etc/nginx/nginx.conf 将自己写的配置文件放到相应的位置
#!/bin/bash
docker build -t jdk-backend:latest .
docker rm -f jdk-backend-web
docker run -itd --name jdk-backend-web jdk-backend:latest
为开发创建启动应用按钮