title: sh script doesn't work in docker container
body: <p>I have a problem running a <code>.sh</code> script inside a docker container. It gives me: </p>
  
  <blockquote>
    <p>ml_1      | 2018-08-02 08:31:32,680 INFO spawned: 'datagrid'
    with pid 18</p>
    
    <p>ml_1      | 2018-08-02 08:31:32,686 INFO exited: datagrid
    (exit status 127; not expected) </p>
    
    <p>ml_1      | 2018-08-02 08:31:38,732 INFO gave up: datagrid
    entered FATAL state, too many start retries too quickly</p>
  </blockquote>
  
  <p>My script:</p>
  
  <pre><code>#!/bin/bash
  
  # Description: 
  
  LIB=/home/com/com_server/lib
  CONFIG=/home/com/com_server/config
  JAVA="/usr/bin/java"
  CLASSPATH=${CONFIG}:blackBoard.xml:${CONFIG}:hazelcastContext.xml:${CONFIG}:comAppConfig.xml:${LIB}:com-calc-0.0.1.jar:${LIB}:com-common-0.0.1.jar:${LIB}:com-hazelcast-0.0.1-jar-with-dependencies.jar:${LIB}:escomled-server-0.0.1.jar:${LIB}:spring-webmvc-4.3.0.RELEASE.jar:${LIB}:spring-jdbc-4.3.0.RELEASE.jar:${LIB}:spring-context-4.3.0.RELEASE.jar:${LIB}:hazelcast-spring-3.7.2.jar:${LIB}:hazelcast-client-3.8.3.jar:${LIB}:hazelcast-spring-3.8.3.jar:${LIB}:hazelcast-all-3.8.3.jar:${LIB}:hazelcast-3.8.3.jar:${LIB}:spring-core-4.3.0.RELEASE.jar:${LIB}:spring-beans-4.3.0.RELEASE.jar:${LIB}:log4j-1.2.16.jar:${LIB}:commons-logging-1.2.jar:${LIB}:spring-asm-4.3.0.RELEASE.jar:${LIB}:spring-expression-4.3.0.RELEASE.jar:${LIB}:mysql-connector-java-5.1.34.jar:${LIB}:spring-tx-4.3.0.RELEASE.jar:${LIB}:commons-lang-2.6.jar:${LIB}:mail-1.4.1.jar:${LIB}:commons-digester-2.0.jar:${LIB}:commons-codec-1.4.jar:${LIB}:slf4j-log4j12-1.5.10.jar:${LIB}:slf4j-api-1.5.10.jar:${LIB}:config/createClient.sql:${LIB}:commons-fileupload-1.2.jar:${LIB}:commons-io-1.4.jar:${LIB}:spring-web-4.3.0.RELEASE.jar:${LIB}:opencsv-2.3.jar:${LIB}:spring-aop-4.3.0.RELEASE.jar:${LIB}:aopalliance-1.0.jar:${LIB}:pdfbox-1.8.9.jar:${LIB}:fontbox-1.8.9.jar:${LIB}:jempbox-1.8.9.jar:${LIB}:imgscalr-lib-4.2.jar:${LIB}:dom4j-1.6.1.jar:${LIB}:xmlbeans-2.6.0.jar:${LIB}:jasypt-1.9.2.jar:${LIB}:jackson-mapper-asl-1.9.4.jar:${LIB}:jackson-core-asl-1.9.4.jar:${LIB}:jackson-jaxrs-1.9.4.jar:${LIB}:cglib-2.2.2.jar:${LIB}:asm-3.3.1.jar:${LIB}:textmagic-java-sdk-1.2.0.jar:${LIB}:httpclient-4.5.5.jar:${LIB}:commons-dbcp2-2.3.0.jar:${LIB}:commons-pool2-2.5.0.jar:${LIB}:poi-3.17.jar:${LIB}:poi-ooxml-3.17.jar:${LIB}:commons-collections4-4.1.jar:${LIB}:poi-ooxml-schemas-3.17.jar
  SERVER_NAME="com_datagrid"
  SLOG_NAME="com_datagrid"
  PID_FILE="/var/run/${SLOG_NAME}.pid"
  MEMORY="512";
  ARGS="-Djava.awt.headless=true -Xmx1024M -Dcom.sun.management.jmxremote=true \
                    -Dcom.sun.management.jmxremote.port=9092 \
                    -Dcom.sun.management.jmxremote.ssl=false \
                    -Dcom.sun.management.jmxremote.authenticate=false \
                    -Djava.rmi.server.hostname=10.72.4.13 -Dhazelcast.diagnostics.enabled=true -Dhazelcast.diagnostics.metric.level=info -Dhazelcast.diagnostics.invocation.sample.period.seconds=30 -Dhazelcast.diagnostics.pending.invocations.period.seconds=30 -Dhazelcast.diagnostics.slowoperations.period.seconds=30"
  start() {
       tput setaf 2;echo "---- STARTING *** com_datagrid *** DAEMON ----"
       ${JAVA} ${ARGS} -classpath "${CLASSPATH}" com.com.blackboard.main.Server &amp;
       javaPID=$!
       tput setaf 7;echo "*** com_datagrid *** backgrounded with process id '${javaPID}'"
       #echo ${javaPID} &gt; ${PID_FILE}
  }
  
  stop() {
     echo "STOPING *** com_datagrid ***"
     start-stop-daemon --stop \
        --pidfile ${PID_FILE}
  }
  restart() {
       stop
       start
  }
  case "$1" in
    start)
          start
          ;;
    stop)
          stop
          ;;
    restart)
          stop
          start
          ;;
  esac
  
  exit 0;
  </code></pre>
  
  <p>My <code>Dockerfile</code>: </p>
  
  <pre><code>#FROM maven:3.3.9-jdk-8-alpine as build-env
  #COPY . /comML
  #WORKDIR comML
  #RUN mvn package
  
  FROM openjdk:8-jdk-alpine
  WORKDIR /comML
  ADD . /comML
  ADD ./MLScripts/lib comML/lib
  ADD ./MLScripts/config com/config
  ADD ./MLScripts/config com/home/com/com_server/config
  ADD ./MLScripts comML/MLScripts
  ADD target/com-machine-learning-0.0.1-SNAPSHOT-jar-with-dependencies.jar comML/lib/com-machine-learning-0.0.1-SNAPSHOT-jar-with-dependencies.jar
  COPY ./MLScripts/wrapper.sh /com/MLScripts/wrapper.sh
  #CMD ["export", "CLASSPATH=comML/home/com/com_server/config/blackBoard.xml;EscomledML/home/com/com_server/config/appContext.xml;comML/home/com/com_server/config/config.properties;comML/home/com/com_server/config/com.properties;comML/home/com/escomled_server/config/createClient.sql;EscomledML/home/escomled/escomled_server/config/escomled.properties;com/home/com/com_server/config/global_database.sql;comML/home/com/com_server/config/release.sql;comML/home/escomled/com_server/config/taskExecutors.xml;comML/home/com/com_server/config/test-applicationContext.xml;C:/home/com/com_server/lib/spring-jdbc-4.3.0.RELEASE.jar;C:/home/escomled/escomled_server/lib/escomled-common-0.0.1.jar;C:/home/escomled/escomled_server/lib/escomled-machine-learning-0.0.1-SNAPSHOT-jar-with-dependencies.jar;C:/home/escomled/escomled_server/lib/assertj-core-3.3.0.jar;C:/home/escomled/escomled_server/lib/curator-test-2.9.0.jar;C:/home/escomled/escomled_server/lib/h2o-genmodel-3.18.0.1.jar;C:/home/escomled/escomled_server/lib/hazelcast-all-3.8.3.jar;C:/home/escomled/escomled_server/lib/jcl-over-slf4j-1.7.1.jar;C:/home/escomled/escomled_server/lib/junit-4.12.jar;C:/home/escomled/escomled_server/lib/spring-jdbc-4.3.0.RELEASE.jar;C:/home/escomled/escomled_server/lib/spring-dao-2.0.3.jar;C:/home/escomled/escomled_server/lib/kafka_2.11-0.10.2.1-cp1.jar;C:/home/escomled/escomled_server/lib/kafka_2.11-0.10.2.1-cp1-test.jar;C:/home/escomled/escomled_server/lib/kafka-clients-0.10.2.1-cp1.jar;C:/home/escomled/escomled_server/lib/spring-context-4.3.0.RELEASE.jar;C:/home/escomled/escomled_server/lib/spring-core-4.3.0.RELEASE.jar;C:/home/escomled/escomled_server/lib/spring-tx-4.3.0.RELEASE.jar;C:/home/escomled/escomled_server/lib/hazelcast-all-3.8.3.jar;C:/home/escomled/escomled_server/lib/kafka-clients-0.10.2.1-cp1-test.jar;C:/home/escomled/escomled_server/lib/kafka-schema-registry-3.2.1.jar;C:/home/escomled/escomled_server/lib/kafka-schema-registry-3.2.1-tests.jar;C:/home/escomled/escomled_server/lib/kafka-streams-0.10.2.1-cp1.jar;C:/home/escomled/escomled_server/lib/slf4j-api-1.7.1.jar;C:/home/escomled/escomled_server/lib/slf4j-log4j12-1.7.1.jar"] 
  #ENTRYPOINT ["java", "-cp", "EscomledML/home/escomled/escomled_server/config/blackBoard.xml;EscomledML/home/escomled/escomled_server/config/appContext.xml;EscomledML/home/escomled/escomled_server/config/config.properties;EscomledML/home/escomled/escomled_server/config/escomled.properties;EscomledML/home/escomled/escomled_server/config/createClient.sql;EscomledML/home/escomled/escomled_server/config/escomled.properties;EscomledML/home/escomled/escomled_server/config/global_database.sql;EscomledML/home/escomled/escomled_server/config/release.sql;EscomledML/home/escomled/escomled_server/config/taskExecutors.xml;EscomledML/home/escomled/escomled_server/config/test-applicationContext.xml;C:/home/escomled/escomled_server/lib/spring-jdbc-4.3.0.RELEASE.jar;C:/home/escomled/escomled_server/lib/escomled-common-0.0.1.jar;C:/home/escomled/escomled_server/lib/escomled-machine-learning-0.0.1-SNAPSHOT-jar-with-dependencies.jar;C:/home/escomled/escomled_server/lib/assertj-core-3.3.0.jar;C:/home/escomled/escomled_server/lib/curator-test-2.9.0.jar;C:/home/escomled/escomled_server/lib/h2o-genmodel-3.18.0.1.jar;C:/home/escomled/escomled_server/lib/hazelcast-all-3.8.3.jar;C:/home/escomled/escomled_server/lib/jcl-over-slf4j-1.7.1.jar;C:/home/escomled/escomled_server/lib/junit-4.12.jar;C:/home/escomled/escomled_server/lib/spring-jdbc-4.3.0.RELEASE.jar;C:/home/escomled/escomled_server/lib/spring-dao-2.0.3.jar;C:/home/escomled/escomled_server/lib/kafka_2.11-0.10.2.1-cp1.jar;C:/home/escomled/escomled_server/lib/kafka_2.11-0.10.2.1-cp1-test.jar;C:/home/escomled/escomled_server/lib/kafka-clients-0.10.2.1-cp1.jar;C:/home/escomled/escomled_server/lib/spring-context-4.3.0.RELEASE.jar;C:/home/escomled/escomled_server/lib/spring-core-4.3.0.RELEASE.jar;C:/home/escomled/escomled_server/lib/spring-tx-4.3.0.RELEASE.jar;C:/home/escomled/escomled_server/lib/hazelcast-all-3.8.3.jar;C:/home/escomled/escomled_server/lib/kafka-clients-0.10.2.1-cp1-test.jar;C:/home/escomled/escomled_server/lib/kafka-schema-registry-3.2.1.jar;C:/home/escomled/escomled_server/lib/kafka-schema-registry-3.2.1-tests.jar;C:/home/escomled/escomled_server/lib/kafka-streams-0.10.2.1-cp1.jar;C:/home/escomled/escomled_server/lib/slf4j-api-1.7.1.jar;C:/home/escomled/escomled_server/lib/slf4j-log4j12-1.7.1.jar", "com.escomled.machinelearning.ml.Escomled_Streams_H2O_ML"]
  #CMD ["java", "-jar", "escomled-machine-learning-0.0.1-SNAPSHOT-jar-with-dependencies.jar"]
  EXPOSE 8085
  #ENTRYPOINT ["sh", "EscomledML/MLScripts/wrapper.sh"]
  #ENTRYPOINT ["sh", "EscomledML/MLScripts/escomled_data_grid.sh"]
  #CMD ["sh", "EscomledML/MLScripts/escomled_dirwatcher.sh", "&amp;&amp;", "sh", "EscomledML/MLScripts/escomled_startmap.sh", "&amp;&amp;", "sh", "EscomledML/MLScripts/escomled_ml.sh"]
  
  FROM ubuntu:14.04
  RUN apt-get update &amp;&amp; apt-get install -y supervisor
  RUN mkdir -p /var/log/supervisor
  COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
  CMD /usr/bin/supervisord -n
  </code></pre>
  
  <p>And my <code>.bat</code> script:</p>
  
  <pre><code>set LIB=C:/home/escomled/escomled_server/lib
  set CONFIG=C:/home/escomled/escomled_server/config
  set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_144"
  set CLASSPATH=%CONFIG%/blackBoard.xml;%CONFIG%/hazelcastContext.xml;%CONFIG%/escomledAppConfig.xml;%LIB%/escomled-calc-0.0.1.jar;%LIB%/escomled-common-0.0.1.jar;%LIB%/escomled-hazelcast-0.0.1-jar-with-dependencies.jar;%LIB%/escomled-server-0.0.1.jar;%LIB%/spring-webmvc-4.3.0.RELEASE.jar;%LIB%/spring-jdbc-4.3.0.RELEASE.jar;%LIB%/spring-context-4.3.0.RELEASE.jar;%LIB%/hazelcast-spring-3.7.2.jar;%LIB%/hazelcast-client-3.8.3.jar;%LIB%/hazelcast-spring-3.8.3.jar;%LIB%/hazelcast-all-3.8.3.jar;%LIB%/hazelcast-3.8.3.jar;%LIB%/spring-core-4.3.0.RELEASE.jar;%LIB%/spring-beans-4.3.0.RELEASE.jar;%LIB%/log4j-1.2.16.jar;%LIB%/commons-logging-1.2.jar;%LIB%/spring-asm-4.3.0.RELEASE.jar;%LIB%/spring-expression-4.3.0.RELEASE.jar;%LIB%/mysql-connector-java-5.1.34.jar;%LIB%/spring-tx-4.3.0.RELEASE.jar;%LIB%/commons-lang-2.6.jar;%LIB%/mail-1.4.1.jar;%LIB%/commons-digester-2.0.jar;%LIB%/commons-codec-1.4.jar;%LIB%/slf4j-log4j12-1.5.10.jar;%LIB%/slf4j-api-1.5.10.jar;%LIB%/config/createClient.sql;%LIB%/commons-fileupload-1.2.jar;%LIB%/commons-io-1.4.jar;%LIB%/spring-web-4.3.0.RELEASE.jar;%LIB%/opencsv-2.3.jar;%LIB%/spring-aop-4.3.0.RELEASE.jar;%LIB%/aopalliance-1.0.jar;%LIB%/pdfbox-1.8.9.jar;%LIB%/fontbox-1.8.9.jar;%LIB%/jempbox-1.8.9.jar;%LIB%/imgscalr-lib-4.2.jar;%LIB%/dom4j-1.6.1.jar;%LIB%/xmlbeans-2.6.0.jar;%LIB%/jasypt-1.9.2.jar;%LIB%/jackson-mapper-asl-1.9.4.jar;%LIB%/jackson-core-asl-1.9.4.jar;%LIB%/jackson-jaxrs-1.9.4.jar;%LIB%/cglib-2.2.2.jar;%LIB%/asm-3.3.1.jar;%LIB%/textmagic-java-sdk-1.2.0.jar;%LIB%/httpclient-4.5.5.jar;%LIB%/commons-dbcp2-2.3.0.jar;%LIB%/commons-pool2-2.5.0.jar;%LIB%/poi-3.17.jar;%LIB%/poi-ooxml-3.17.jar;%LIB%/commons-collections4-4.1.jar;%LIB%/poi-ooxml-schemas-3.17.jar
  
  set SERVER_NAME="escomled_server"
  set SLOG_NAME="escomled_server"
  set PID_FILE="/var/run/%SLOG_NAME%.pid"
  set MEMORY="512";
   set ARGS="-Djava.awt.headless=true -Xmx1024M -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9092 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=10.72.4.13 -Dhazelcast.diagnostics.enabled=true -Dhazelcast.diagnostics.metric.level=info -Dhazelcast.diagnostics.invocation.sample.period.seconds=30 -Dhazelcast.diagnostics.pending.invocations.period.seconds=30 -Dhazelcast.diagnostics.slowoperations.period.seconds=30"
  :start
     ECHO "---- STARTING *** DataGrid *** DAEMON ----"
     %JAVA_HOME%\bin\java.exe %ARGS% -classpath %CLASSPATH% com.escomled.blackboard.main.DataGridServer
     ECHO "*** DataGrid *** backgrounded with process id %javaPID%"
     ECHO %javaPID% &gt; %PID_FILE%
     EXIT /B 0
  
  :stop
     ECHO "STOPING *** DataGrid ***"
     start-stop-daemon --stop --pidfile %PID_FILE%
     EXIT /B 0
  
  :restart
       CALL :stop
       CALL :start
  
  rem case "$1" in
  rem  start)
  rem        start
  rem        ;;
  rem  stop)
  rem        stop
  rem        ;;
  rem  restart)
  rem        stop
  rem        start
  rem        ;;
  rem esac
  
  rem exit 0;
  </code></pre>
  
  <p>I will edit the question if I didn't explain something right. Thank you.</p>