docker container does not start Java in background -


docker has start java/undertow application during build phase , should available during run phase. container changes related starting of java server not persisted after java process got launched.

so changes done during step makes no impact on image.

the last command in docker file

run java -jar /svc/app/svc-0.0.1-snapshot.jar $2>server.log & sleep 5 

when run container can see output exists in server.log file confirming server started

startservices        - services started  

but when run container there no service running. can start manually not how want it. want server been when container up.

notice

& sleep 5 

if not wait these 5 seconds no log created. docker abandon step without letting java application start.

however "sleep 5" let application start, docker still ignores changes in image , not apply them.

so when "docker run" application not running.

here dockerfile :

from anapsix/alpine-java env  tc_base=/opt/tc_base env  app_base=$tc_base/svc env  path=.:$path   run apk update && apk add unzip   copy files/build/lib/svc/target/svc-0.0.1-snapshot-bin.zip $app_base/ copy files/build/lib/api/src/main/resources/api.properties $tc_base/conf/api/ copy files/build/lib/svc/src/main/resources/svc.properties $tc_base/conf/svc/ copy files/build/lib/svc/src/main/resources/logback.xml $tc_base/conf/svc/  run cd $app_base ; unzip -q svc-0.0.1-snapshot-bin.zip ; rm svc-0.0.1-snapshot-bin.zip ; mv svc-0.0.1-snapshot/* . ; rm -rf svc-0.0.1-snapshot  expose 7009  run java -jar $tc_base/svc/app/svc-0.0.1-snapshot.jar $2>server.log & sleep 5 

well, should entrypoint not run. entrypoint invoked when container starts , need. run executed during build time affects filesystem. docker image not contain execution state of application, when image created not have information application have been started. in order start applications have set entrypoint


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -