dockerfile内容:
# lims docker配置
FROM carsharing/alpine-oraclejdk8-bash
MAINTAINER JacksonTu (tuminglong@126.com)
ENV PROJECT_HOME /home/project
ENV TOMCAT_HOME /home/nginx
ENV OUTPUT_HOME /output
ENV JAVA_OPTS="-Xms1024m -Xmx1024m -Xss1m -Xmn512m"
RUN mkdir -p "$PROJECT_HOME" && mkdir -p "$OUTPUT_HOME" && mkdir -p "$TOMCAT_HOME"
ADD jeecg-boot-module-system-2.2.1.jar $PROJECT_HOME/jeecg-boot-module-system-2.2.1.jar
WORKDIR /home/project
# 指定容器内的时区
RUN echo "Asia/Shanghai" > /etc/timezone
ENTRYPOINT ["sh","-c","java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar $PROJECT_HOME/jeecg-boot-module-system-2.2.1.jar > run.log"]
EXPOSE 8080 10001 20011 20012
# docker run -it -d --name lims -p8080:8080 -p20010:20010 -v /home/output:/output -v /home/nginx:/home/nginx jeecg-boot-module-system-2.2.1.jar --restart=always
run.sh 文件内容:
#!/bin/bash
/docker/iot-factory
echo 'begin docker'
# 查看正在运行的容器
echo 'view container'
docker ps
#停止容器
echo 'stop container'
docker stop lims
#删除容器
echo 'delete container'
docker rm -f lims
#docker images
#删除镜像
echo 'delete images'
docker rmi -f jeecg-boot-module-system:2.2.1
#创建镜像
echo 'create images'
docker build -t jeecg-boot-module-system:2.2.1 .
#运行容器
echo 'run container'
#运行容器
docker run -it -d --name lims -p8080:8080 -p10001:10001 -p20011:20011 -v /home/output:/output -v /home/nginx:/home/nginx jeecg-boot-module-system:2.1.1 --restart=always
echo 'end docker'