title: why one linux command is working inside conatiner but not in entrpoint.sh
body: <p><strong>I am using ubuntu 16.04 OS as VM.</strong></p>
  
  <p>While creating container, i have some commands in entrpoint.sh which is not working or behaving as expected but the same command is working when i am manually running inside the container, to be precise below is my simple linux <strong>cp</strong> command which recursively copy from source to destination and also unzip command.</p>
  
  <p><strong><em>In my entrypoint.sh I have three commands :</em></strong></p>
  
  <pre><code>  cd /tmp/localization/Tpae7610
    unzip \*.zip
    cp -r /tmp/localization/Tpae7610/*  /home/db2inst1/maximo/
  </code></pre>
  
  <p>Last two commands are not working when container starts, when I say it's not working it means it is not giving any error but not copying the source contents to destinations as expected also it is not unzipping the .zip files</p>
  
  <p><strong>NOTE:</strong> But same command is working as expected when i manually run inside the container.</p>
  
  <p><strong>entrypoint.sh</strong></p>
  
  <pre><code>#!/bin/bash
  sysctl -w kernel.shmmni=1024
  sysctl -w kernel.shmall=2097152
  sysctl -w kernel.msgmnb=65536
  sysctl -w kernel.msgmax=65536
  sysctl -w kernel.msgmni=4096
  sysctl -w kernel.shmmax=4294967296
  
  #set -e
  #
  #   Initialize DB2 instance in a Docker container
  #
  # # Authors:
  #   * 
  #
  # 
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #      http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  mkdir -p /db2fs
  chown db2inst1:db2iadm1 /db2fs
  chmod -R 755 /db2fs
  
  #cp /tmp/maxinst.sh /home/db2inst1/maximo/Maximo-7.6-CD/tools/maximo/maxinst.sh
  
  if [ -z "$DB2INST1_PASSWORD" ]; then
    echo ""
    echo &gt;&amp;2 'error: DB2INST1_PASSWORD not set'
    echo &gt;&amp;2 'Did you forget to add -e DB2INST1_PASSWORD=... ?'
    exit 1
  else
    echo "db2inst1:$DB2INST1_PASSWORD" | chpasswd
  fi
  
  if [ -z "$LICENSE" ];then
     echo ""
     echo &gt;&amp;2 'error: LICENSE not set'
     echo &gt;&amp;2 "Did you forget to add '-e LICENSE=accept' ?"
     exit 1
  fi
  
  if [ "${LICENSE}" != "accept" ];then
     echo ""
     echo &gt;&amp;2 "error: LICENSE not set to 'accept'"
     echo &gt;&amp;2 "Please set '-e LICENSE=accept' to accept License before use the DB2 software contained in this image."
     exit 1
  fi
  
  if [[ $1 = "db2start" ]]; then
      echo "Performing botc database start"
      if [ ! -d /db2fs/db2inst1 ]; then
        echo "Database location does not exist, creating database"
        chown -R db2inst1:db2iadm1 /maxdb7605
        chown -R db2inst1:db2iadm1 /home/db2inst1/maximo 
        find /maxdb7605 -type d -exec chmod 755 \{\} \;
        find /maxdb7605 -type f -exec chmod 644 \{\} \;
        cd /home/db2inst1/maximo
        #unzip -o tools.zip &amp;&amp; rm tools.zip
        #unzip -o applications.zip &amp;&amp; rm applications.zip 
        set -x 
        cd /home/db2inst1/maximo/tools
        if [ ! -f java ]; then
           ln -s /home/db2inst1/sqllib/java  java
        fi
        su - db2inst1 &lt;&lt;EOH
        db2start
        db2 create database maxdb76 on /db2fs dbpath on /db2fs using codeset UTF-8 territory us pagesize 32 K
        db2 connect to maxdb76
        db2 create bufferpool MAXBUFFPOOL pagesize 32K
        db2 grant connect on database to user maximo
        db2 GRANT DBADM,SECADM, CREATETAB,BINDADD,CONNECT,CREATE_NOT_FENCED_ROUTINE,IMPLICIT_SCHEMA,LOAD,CREATE_EXTERNAL_ROUTINE,QUIESCE_CONNECT ON DATABASE TO USER maximo
        db2 GRANT USAGE on WORKLOAD SYSDEFAULTUSERWORKLOAD TO USER maximo;
        db2 create schema maximo authorization maximo
        db2 create regular tablespace MAXDATA pagesize 32k managed by automatic storage extentsize 16 overhead 12.67 prefetchsize 16 transferrate 0.18 bufferpool MAXBUFFPOOL dropped table recovery on NO FILE SYSTEM CACHING
        db2 grant use of tablespace MAXDATA to user maximo
        db2 update db cfg using LOGFILSIZ 5000
        db2 update db cfg using LOGPRIMARY 50
        db2 update db cfg using LOGSECOND 50
  
        db2 connect reset
        db2stop force
        db2start
  
        cd /maxdb7605
        db2set DB2CODEPAGE=1208
        db2 connect to maxdb76
        db2 -t -f /maxdb7605/dbschema.sql
        db2 -t -f /maxdb7605/dev_grants.sql
        db2move maxdb76 LOAD -u maximo -p maximo -l lobs
        db2 connect to maxdb76 user maximo using maximo
        db2 -x "select 'values nextval for MAXIMO.',sequencename,';' from maxsequence" &gt; /maxdb7605/sequence_update.sql
        db2 -t -f /maxdb7605/sequence_update.sql
        db2 connect reset
  EOH
        rm -rf /maxdb7605
  
        set +x
        nohup /usr/sbin/sshd -D 2&gt;&amp;1 &gt; /dev/null &amp;
        cd /home/db2inst1/maximo/tools/maximo
        chmod +x TDToolkit.sh
        chmod +x updatedb.sh
        dos2unix TDToolkit.sh
        dos2unix updatedb.sh
        ./updatedb.sh
        export JAVA_HOME=/opt/ibm/java-x86_64-70
        export JRE_HOME=/opt//home/db2inst1/maximoibm/java-x86_64-70/jre
        export PATH=${JAVA_HOME}/bin:$PATH
  
        cd /
        cd /tmp/localization/Tpae7610
        unzip \*.zip
        cp -a /tmp/localization/Tpae7610/*  /home/db2inst1/maximo/
  
        cd /tmp/localization/Lightning7604
        unzip \*.zip
        cp -a /tmp/localization/Lightning7604/*  /home/db2inst1/maximo/
  
        cd /tmp/localization/BOTC7610
        unzip \*.zip
        cp -a /tmp/localization/BOTC7610/* /home/db2inst1/maximo/
  
        cd /tmp
        #remove localization folder from tmp folder
        rm -rf localization
  
        cd /home/db2inst1/maximo/tools/maximo
        #./TDToolkit.sh -addlangPT -useexpander
        #./TDToolkit.sh -addlangJA -useexpander
        #./TDToolkit.sh -addlangDE -useexpander
        #./TDToolkit.sh -addlangIT -useexpander
        #./TDToolkit.sh -addlangFR -useexpander
        #./TDToolkit.sh -addlangES -useexpander
  
        #./TDToolkit.sh -pmpupdatenxtgenui -useexpander 
        # ./TDToolkit.sh -pmpupdatez_botc -useexpander
  
        chmod -R 777 /home/db2inst1/maximo/tools/maximo/log
        #healthcheck looks for this file to indicate the container is initialized
        touch /tmp/container_started
        while true; do sleep 1000; done
        exec "/bin/bash"
      #statements
    else
      su - db2inst1 &lt;&lt;EOH
      db2start
      db2 catalog db maxdb76 on /db2fs
      db2 terminate
      db2 connect to maxdb76
  EOH
      touch /tmp/container_started
      while true; do sleep 1000; done
      exec "/bin/bash"
    fi
  
    sleep 10
  fi
  </code></pre>