docker 帶參數啓動 配合springboot profile

dockerfilejava

FROM frolvlad/alpine-oraclejdk8:slim VOLUME /tmp ADD test-push-service-0.0.1-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" ]

 

運行鏡像:spring

sudo docker run -it -d --restart unless-stopped -p 8001:8001 --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 Tag 


QA: CE
="dev" ,test= CE="test"
相關文章
相關標籤/搜索