我有一个docker-entrypoint.sh文件,该文件从jboss-eap-7执行standalone.sh,请参阅:
#!/bin/bash
set -e
sh $JBOSS_HOME/bin/standalone.sh -DANTLR_USE_DIRECT_CLASS_LOADING=true
exec "$@"
这很好,但是在我的容器中运行ps -eaf
时,我得到了以下进程列表:
PID USER TIME COMMAND
1 jboss 0:00 {docker-entrypoi} /bin/bash /usr/local/bin/docker-entrypoint.sh
8 jboss 0:00 sh /home/jboss/jboss-eap-7.1/bin/standalone.sh -DANTLR_USE_DIRECT_CLASS_LOADING=true
66 jboss 1:22 /usr/lib/jvm/java-1.8-openjdk/bin/java -D[Standalone] -server -verbose:gc -Xloggc:/home/jboss/jboss-eap-7.1/standalone/log/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Djava.net.preferIPv4Stack=true -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0 -Dorg.jboss.boot.log.file=/home/jboss/jboss-eap-7.1/standalone/log/server.log -Dlogging.configuration=file:/home/jboss/jboss-eap-7.1/standalone/configuration/logging.properties -jar /home/jboss/jboss-eap-7.1/jboss-modules.jar -mp /home/jboss/jboss-eap-7.1/modules org.jboss.as.standalone -Djboss.home.dir=/home/jboss/jboss-eap-7.1 -Djboss.server.base.dir=/home/jboss/jboss-eap-7.1/standalone -DANTLR_USE_DIRECT_CLASS_LOADING=true
293 jboss 0:00 ps -eaf
看,standalone.sh获得PID 8,因此,当我发送docker stop
时,会有10秒的延迟并被强制杀死,但是我想发送正常关机。
任何解决此问题的技巧吗?
答案 0 :(得分:0)
docker stop ---- time = 30 foo
(来源:https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/)