正文
docker 带参数启动 配合springboot profile
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
dockerfile
FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD test-push-service-0.0.-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENV CE=$CE
ENV JAVA_OPTS=$JAVA_OPTS
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar --spring.config.name=application-$CE" ]
运行镜像:
sudo docker run -it -d --restart unless-stopped -p : --net host -e CE="dev" -e JAVA_OPTS="-Xmx128m -Xss512k" -v /opt/docker/test-push-service/log/:/tmp/ -m 500m --memory-reservation 500m
$Image Name:$Image TagQA: CE="dev" ,test= CE="test"