docker - Dockerizing ambry -
hi im trying run ambry in docker
part of docker-compose.yml file:
ambry: build: resources/ambry and dockerfile :
from alpine:latest user root run \ apk update && \ apk upgrade && \ apk add git && \ apk add bash && \ apk add openjdk8 && \ rm -rf /var/cache/apk/* env java_home /usr/lib/jvm/java-1.8-openjdk workdir /tmp cmd ["sh"] run git clone https://github.com/linkedin/ambry.git workdir ambry run ./gradlew alljar workdir target cmd mkdir logs cmd java -dlog4j.configuration=file:../config/log4j.properties -jar ambry.jar --serverpropsfilepath ../config/server.properties --hardwarelayoutfilepath ../config/hardwarelayout.json --partitionlayoutfilepath ../config/partitionlayout.json > logs/server.log & cmd java -dlog4j.configuration=file:../config/log4j.properties -cp "*" com.github.ambry.frontend.ambryfrontendmain --serverpropsfilepath ../config/frontend.properties --hardwarelayoutfilepath ../config/hardwarelayout.json --partitionlayoutfilepath ../config/partitionlayout.json > logs/frontend.log & i doing commands in shell , taken https://github.com/linkedin/ambry. , works fine docker on start exit..:
dockerized_ambry_1 exited code 0 any 1 know why exists ?
https://docs.docker.com/engine/reference/builder/#cmd
there can 1
cmdinstruction in dockerfile. if list more 1cmdlastcmdtake effect.
looks cmd of yours runs "run java class com.github.ambry.frontend.ambryfrontendmain". launch background process (you specified &).
the container lifetime tied "launch background task", completes immediately. container exits immediately.
since container responsible launching two services (ambry.jar, com.github.ambry.frontend.ambryfrontendmain): want container lifetime tied both of those, , want sigterm sent container, elegantly shutdown both of those.
i recommend using init system start & end services. alpine linux typically uses openrc, iirc dockerized alpine linux not have init system, need find variant (or install yourself).
personally i've found it's non-trivial use init systems docker: common problem logs don't go container's stdout; until overcome that, can black box. luck!
Comments
Post a Comment