1、Dockerfile 构建文件定义参数
FROM java:8
VOLUME ["/home/pdsstm/uploads/pdsfile"]
COPY pds-stm-management.jar /home/pds-stm/jar/pds-stm-management.jar
ENV CE=$CE
EXPOSE 31080
ENTRYPOINT [ "sh", "-c", "java -Djava.security.egd=file:/dev/./urandom -jar /home/pds-stm/jar/pds-stm-management.jar --spring.profiles.active=$CE" ]
定义变量 CE
2、进入到 文件夹下构建镜像
docker build -t pds-stm .
3、带参数运行镜像
docker run -d -p 38082:31080 --name pds-stm -e CE="test" -v /home/pds-stm/jar:/home/pds-stm/jar -v /home/pds-stm/logs:/logs --restart=always pds-stm