title: exit code 127 and ': No such file or directory`
body: <p>The container `` below is exiting with code 127 and the message <code>': No such file or directory</code>.  </p>
  
  <blockquote>
    <p><strong>What specific changes need to be made in order for this error to resolve so that the container can run successfully?</strong>  </p>
  </blockquote>
  
  <p><hr><strong>docker inspect</strong><hr></p>
  
  <p>The following are the results of <code>docker ps -a -q</code>, followed by <code>docker inspect 1d86d855a3d1</code>    </p>
  
  <pre><code>C:\projects\docker\crowd\atlassian-crowd-docker&gt;docker ps -a -q
  1d86d855a3d1
  
  C:\projects\docker\crowd\atlassian-crowd-docker&gt;docker inspect 1d86d855a3d1
  [
      {
          "Id": "1d86d855a3d13d7b9e695cce9490b6f4700c61027287f7383110cf6937d81b3b",
          "Created": "2018-07-25T23:30:58.584251386Z",
          "Path": "/opt/start.sh",
          "Args": [
              "run"
          ],
          "State": {
              "Status": "exited",
              "Running": false,
              "Paused": false,
              "Restarting": false,
              "OOMKilled": false,
              "Dead": false,
              "Pid": 0,
              "ExitCode": 127,
              "Error": "",
              "StartedAt": "2018-07-25T23:37:02.200147887Z",
              "FinishedAt": "2018-07-25T23:37:02.192281696Z"
          },
          "Image": "sha256:0176cf7cd57ac2b73eb4a0fc4fb907fcd6ab772a5c5e9b9ce3e45a32e8d66d1d",
          "ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/1d86d855a3d13d7b9e695cce9490b6f4700c61027287f7383110cf6937d81b3b/resolv.conf",
          "HostnamePath": "/mnt/sda1/var/lib/docker/containers/1d86d855a3d13d7b9e695cce9490b6f4700c61027287f7383110cf6937d81b3b/hostname",
          "HostsPath": "/mnt/sda1/var/lib/docker/containers/1d86d855a3d13d7b9e695cce9490b6f4700c61027287f7383110cf6937d81b3b/hosts",
          "LogPath": "/mnt/sda1/var/lib/docker/containers/1d86d855a3d13d7b9e695cce9490b6f4700c61027287f7383110cf6937d81b3b/1d86d855a3d13d7b9e695cce9490b6f4700c61027287f7383110cf6937d81b3b-json.log",
          "Name": "/practical_kalam",
          "RestartCount": 0,
          "Driver": "aufs",
          "Platform": "linux",
          "MountLabel": "",
          "ProcessLabel": "",
          "AppArmorProfile": "",
          "ExecIDs": null,
          "HostConfig": {
              "Binds": null,
              "ContainerIDFile": "",
              "LogConfig": {
                  "Type": "json-file",
                  "Config": {}
              },
              "NetworkMode": "default",
              "PortBindings": {
                  "8443/tcp": [
                      {
                          "HostIp": "",
                          "HostPort": "8443"
                      }
                  ]
              },
              "RestartPolicy": {
                  "Name": "no",
                  "MaximumRetryCount": 0
              },
              "AutoRemove": false,
              "VolumeDriver": "",
              "VolumesFrom": null,
              "CapAdd": null,
              "CapDrop": null,
              "Dns": [],
              "DnsOptions": [],
              "DnsSearch": [],
              "ExtraHosts": null,
              "GroupAdd": null,
              "IpcMode": "shareable",
              "Cgroup": "",
              "Links": null,
              "OomScoreAdj": 0,
              "PidMode": "",
              "Privileged": false,
              "PublishAllPorts": false,
              "ReadonlyRootfs": false,
              "SecurityOpt": null,
              "UTSMode": "",
              "UsernsMode": "",
              "ShmSize": 67108864,
              "Runtime": "runc",
              "ConsoleSize": [
                  26,
                  107
              ],
              "Isolation": "",
              "CpuShares": 0,
              "Memory": 0,
              "NanoCpus": 0,
              "CgroupParent": "",
              "BlkioWeight": 0,
              "BlkioWeightDevice": [],
              "BlkioDeviceReadBps": null,
              "BlkioDeviceWriteBps": null,
              "BlkioDeviceReadIOps": null,
              "BlkioDeviceWriteIOps": null,
              "CpuPeriod": 0,
              "CpuQuota": 0,
              "CpuRealtimePeriod": 0,
              "CpuRealtimeRuntime": 0,
              "CpusetCpus": "",
              "CpusetMems": "",
              "Devices": [],
              "DeviceCgroupRules": null,
              "DiskQuota": 0,
              "KernelMemory": 0,
              "MemoryReservation": 0,
              "MemorySwap": 0,
              "MemorySwappiness": null,
              "OomKillDisable": false,
              "PidsLimit": 0,
              "Ulimits": null,
              "CpuCount": 0,
              "CpuPercent": 0,
              "IOMaximumIOps": 0,
              "IOMaximumBandwidth": 0
          },
          "GraphDriver": {
              "Data": null,
              "Name": "aufs"
          },
          "Mounts": [],
          "Config": {
              "Hostname": "1d86d855a3d1",
              "Domainname": "",
              "User": "",
              "AttachStdin": false,
              "AttachStdout": true,
              "AttachStderr": true,
              "ExposedPorts": {
                  "8080/tcp": {},
                  "8443/tcp": {}
              },
              "Tty": false,
              "OpenStdin": false,
              "StdinOnce": false,
              "Env": [
                  "PATH=/usr/local/tomcat/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin",
                  "LANG=C.UTF-8",
                  "JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk/jre",
                  "JAVA_VERSION=8u151",
                  "JAVA_ALPINE_VERSION=8.151.12-r0",
                  "CATALINA_HOME=/usr/local/tomcat",
                  "TOMCAT_NATIVE_LIBDIR=/usr/local/tomcat/native-jni-lib",
                  "LD_LIBRARY_PATH=/usr/local/tomcat/native-jni-lib",
                  "GPG_KEYS=05AB33110949707C93A279E3D3EFE6B686867BA6 07E48665A34DCAFAE522E5E6266191C37C037D42 47309207D818FFD8DCD3F83F1931D684307A10A5 541FBE7D8F78B25E055DDEE13C370389288584E7 61B832AC2F1C5A90F0F9B00A1C506407564C17A3 79F7026C690BAA50B92CD8B66A3AD3F4F22C4FED 9BA44C2621385CB966EBA586F72C284D731FABEE A27677289986DB50844682F8ACB77FC2E86E29AC A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 DCFD35E0BF8CA7344752DE8B6FB21E8933C60243 F3A04C595DB5B6A5F1ECA43E3B7BBB100D811BBE F7DA48BB64BCB84ECBA7EE6935CD23C10D498E23",
                  "TOMCAT_MAJOR=9",
                  "TOMCAT_VERSION=9.0.2",
                  "TOMCAT_SHA1=b59e1d658a4edbca7a81d12fd6f20203a4da9743",
                  "TOMCAT_TGZ_URLS=https://www.apache.org/dyn/closer.cgi?action=download&amp;filename=tomcat/tomcat-9/v9.0.2/bin/apache-tomcat-9.0.2.tar.gz \thttps://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.2/bin/apache-tomcat-9.0.2.tar.gz \thttps://www.apache.org/dist/tomcat/tomcat-9/v9.0.2/bin/apache-tomcat-9.0.2.tar.gz \thttps://archive.apache.org/dist/tomcat/tomcat-9/v9.0.2/bin/apache-tomcat-9.0.2.tar.gz",
                  "TOMCAT_ASC_URLS=https://www.apache.org/dyn/closer.cgi?action=download&amp;filename=tomcat/tomcat-9/v9.0.2/bin/apache-tomcat-9.0.2.tar.gz.asc \thttps://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.2/bin/apache-tomcat-9.0.2.tar.gz.asc \thttps://www.apache.org/dist/tomcat/tomcat-9/v9.0.2/bin/apache-tomcat-9.0.2.tar.gz.asc \thttps://archive.apache.org/dist/tomcat/tomcat-9/v9.0.2/bin/apache-tomcat-9.0.2.tar.gz.asc",
                  "CROWD_HOME=/opt/crowd/home",
                  "CROWD_INSTALL=/opt/crowd/webapp",
                  "CROWD_USER=crowd",
                  "CROWD_GROUP=crowd",
                  "CROWD_VERSION=2.12.0",
                  "MYSQL_CONNECTOR_VERSION=5.1.39"
              ],
              "Cmd": [
                  "run"
              ],
              "ArgsEscaped": true,
              "Image": "debian-crowd",
              "Volumes": null,
              "WorkingDir": "/usr/local/tomcat",
              "Entrypoint": [
                  "/opt/start.sh"
              ],
              "OnBuild": null,
              "Labels": {
                  "org.label-schema.vcs-url": "https://github.com/Dwolla/atlassian-crowd-docker"
              }
          },
          "NetworkSettings": {
              "Bridge": "",
              "SandboxID": "7044cebfde1cd851bae7cc5a5034b4af87318ed89062074bf7236e168c422a6a",
              "HairpinMode": false,
              "LinkLocalIPv6Address": "",
              "LinkLocalIPv6PrefixLen": 0,
              "Ports": {},
              "SandboxKey": "/var/run/docker/netns/7044cebfde1c",
              "SecondaryIPAddresses": null,
              "SecondaryIPv6Addresses": null,
              "EndpointID": "",
              "Gateway": "",
              "GlobalIPv6Address": "",
              "GlobalIPv6PrefixLen": 0,
              "IPAddress": "",
              "IPPrefixLen": 0,
              "IPv6Gateway": "",
              "MacAddress": "",
              "Networks": {
                  "bridge": {
                      "IPAMConfig": null,
                      "Links": null,
                      "Aliases": null,
                      "NetworkID": "bcec3d0b3e8a17638d85d6419deadd4bdd4150659d60358ebb1737e1ac306710",
                      "EndpointID": "",
                      "Gateway": "",
                      "IPAddress": "",
                      "IPPrefixLen": 0,
                      "IPv6Gateway": "",
                      "GlobalIPv6Address": "",
                      "GlobalIPv6PrefixLen": 0,
                      "MacAddress": "",
                      "DriverOpts": null
                  }
              }
          }
      }
  ]
  </code></pre>
  
  <p><hr><strong>docker logs</strong><hr>  </p>
  
  <pre><code>C:\projects\docker\crowd\atlassian-crowd-docker&gt;docker logs 1d86d855a3d1
  ': No such file or directory
  ': No such file or directory
  </code></pre>
  
  <p><hr><strong>Dockerfile</strong><hr>  </p>
  
  <p>Dockerfile looks like:  </p>
  
  <pre><code>FROM tomcat:9.0-alpine
  MAINTAINER Dwolla Engineering &lt;dev+crowd@dwolla.com&gt;
  
  LABEL org.label-schema.vcs-url="https://github.com/Dwolla/atlassian-crowd-docker"
  
  ENV CROWD_HOME=/opt/crowd/home \
      CROWD_INSTALL=/opt/crowd/webapp \
      CROWD_USER=crowd \
      CROWD_GROUP=crowd \
      CROWD_VERSION=2.12.0 \
      MYSQL_CONNECTOR_VERSION=5.1.39 
  
  EXPOSE 8443
  
  COPY redirector /opt/redirector
  
  RUN apk update &amp;&amp; \
      apk add --update curl ca-certificates jq groff less python py-pip bash openssl openjdk8 &amp;&amp; \
      curl https://www.digicert.com/CACerts/GTECyberTrustGlobalRoot.crt | openssl x509 -inform der -outform pem -out /usr/local/share/ca-certificates/GTECyberTrustGlobalRoot.crt &amp;&amp; \
      update-ca-certificates &amp;&amp; \
      rm -rf ${CATALINA_HOME}/webapps/* &amp;&amp; \
      mkdir -p ${CROWD_HOME} ${CROWD_INSTALL} ${CATALINA_HOME}/conf/Catalina/localhost &amp;&amp; \
      cd /opt &amp;&amp; \
      curl -vL -o ${CROWD_INSTALL}/crowd.war https://www.atlassian.com/software/crowd/downloads/binary/atlassian-crowd-${CROWD_VERSION}-war.zip &amp;&amp; \
      cd ${CROWD_INSTALL} &amp;&amp; unzip -n crowd.war &amp;&amp; rm crowd.war &amp;&amp; cd - &amp;&amp; \
      curl -vL -o /tmp/mysql-connector.tgz https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MYSQL_CONNECTOR_VERSION}.tar.gz &amp;&amp; \
      tar xzf /tmp/mysql-connector.tgz mysql-connector-java-${MYSQL_CONNECTOR_VERSION}/mysql-connector-java-${MYSQL_CONNECTOR_VERSION}-bin.jar &amp;&amp; \
      mv mysql-connector-java-5.1.39/mysql-connector-java-${MYSQL_CONNECTOR_VERSION}-bin.jar ${CATALINA_HOME}/lib/mysql-connector-java-${MYSQL_CONNECTOR_VERSION}-bin.jar &amp;&amp; \
      pip install --upgrade pip &amp;&amp; \
      pip install awscli &amp;&amp; \
      sed -i s_securerandom.source=file:/dev/random_securerandom.source=file:/dev/urandom_ $JAVA_HOME/lib/security/java.security &amp;&amp; \
      curl -vL "https://dl.bintray.com/sbt/native-packages/sbt/0.13.15/sbt-0.13.15.tgz" | \
      gunzip | tar -x -C /usr/local &amp;&amp; \
      cd /opt/redirector &amp;&amp; \
      /usr/local/sbt/bin/sbt clean test package &amp;&amp; \
      mkdir -p ${CATALINA_HOME}/webapps/ROOT &amp;&amp; unzip -d ${CATALINA_HOME}/webapps/ROOT target/scala-2.11/*.war &amp;&amp; \
      apk --purge -v del py-pip openjdk8 &amp;&amp; \
      rm -rf /var/cache/apk/* /opt/redirector /usr/local/sbt /tmp/* /root/.ivy2/ /root/.sbt/ /root/.cache/ &amp;&amp; \
      ls -al /usr/lib/jvm/java-1.8-openjdk/jre
  
  COPY context.xml.tmpl /opt/context.xml.tmpl
  COPY server.xml ${CATALINA_HOME}/conf/server.xml
  COPY crowd.cfg.tmpl /opt/crowd.cfg.tmpl
  COPY start.sh /opt/start.sh
  COPY jars/* ${CATALINA_HOME}/lib/
  
  ENTRYPOINT ["/opt/start.sh"]
  CMD ["run"]  
  </code></pre>
  
  <p><hr><strong>start.sh</strong><hr>  </p>
  
  <p><code>start.sh</code> looks like:  </p>
  
  <pre><code>#!/usr/bin/env bash
  set -euo pipefail
  IFS=$'\n\t'
  
  aws s3 cp ${DATABASE_CONFIG_OBJECT} ${CROWD_HOME}/crowduser.json
  aws s3 cp ${CROWD_CONFIG_OBJECT} ${CROWD_HOME}/config.json
  
  if aws s3 ls ${CROWD_SECRETS_OBJECT} &gt; /dev/null; then
    aws s3 cp ${CROWD_SECRETS_OBJECT} ${CROWD_HOME}/config_secrets.json
  else
    cat &lt;&lt;__CONFIG_SECRETS_END__ &gt; ${CROWD_HOME}/config_secrets.json
  {
    "application_password": ""
  }
  __CONFIG_SECRETS_END__
  fi
  
  # Set up JNDI resources in Tomcat root context
  tmpl=$(cat /opt/context.xml.tmpl | sed 's_"_\\"_g')
  printf "\"%s\"" "$tmpl" | jq -r -f /dev/stdin ${CROWD_HOME}/crowduser.json &gt; ${CATALINA_HOME}/conf/Catalina/localhost/crowd.xml
  
  tmpl=$(cat /opt/crowd.cfg.tmpl | sed 's_"_\\"_g')
  printf "\"%s\"" "$tmpl" | jq -r -f /dev/stdin ${CROWD_HOME}/config.json &gt; ${CROWD_HOME}/crowd.cfg.xml
  
  cat &lt;&lt;__PROPERTIES_END__ | xargs -0 printf "\"%s\"" | jq -r -f /dev/stdin ${CROWD_HOME}/config_secrets.json &gt; ${CROWD_HOME}/crowd.properties
  session.lastvalidation=session.lastvalidation
  session.tokenkey=session.tokenkey
  crowd.server.url=https\\\://localhost:8443/crowd/services/
  application.login.url=https\\\://${CROWD_SERVER_URL}/crowd
  crowd.base.url=https\\\://${CROWD_SERVER_URL}/crowd/
  application.name=crowd
  http.timeout=30000
  session.isauthenticated=session.isauthenticated
  session.validationinterval=0
  application.password=\(.application_password)
  __PROPERTIES_END__
  
  cat &lt;&lt;__CROWD_INIT_END__ &gt; ${CROWD_INSTALL}/WEB-INF/classes/crowd-init.properties
  crowd.home=${CROWD_HOME}
  __CROWD_INIT_END__
  
  openssl req -x509 \
      -newkey rsa:4096 \
      -keyout ${CATALINA_HOME}/conf/localhost-rsa-key.pem \
      -out ${CATALINA_HOME}/conf/localhost-rsa-cert.pem \
      -days 365 \
      -nodes \
      -subj "${CROWD_TLS_SUBJ}"
  
  keytool -import \
      -alias crowd \
      -file $CATALINA_HOME/conf/localhost-rsa-cert.pem \
      -keystore $JAVA_HOME/lib/security/cacerts \
      -storepass changeit \
      -noprompt
  
  exec ${CATALINA_HOME}/bin/catalina.sh $@
  </code></pre>
  
  <p><hr><strong>CharlesDuffy's suggestions</strong><hr>  </p>
  
  <p>The result of making @CharlesDuffy's suggested change to print errors to stderr looks like:  </p>
  
  <pre><code>C:\projects\docker\crowd\atlassian-crowd-docker&gt;docker run -p 8443:8443 mycrowd  
  + PS4=':$BASH_SOURCE:$LINENO+'  
  :/opt/start.sh:2+set -x  
  :/opt/start.sh:2+$':\r'  
  /opt/start.sh: line 2: $':\r': command not found  
  :/opt/start.sh:3+set -euo $'pipefail\r'  
  : invalid option name: set: pipefail  
  </code></pre>
  
  <p>And then the next iteration resulted in:  </p>
  
  <pre><code>C:\projects\docker\crowd\atlassian-crowd-docker&gt;docker run -p 8443:8443 mycrowd
  + PS4=':$BASH_SOURCE:$LINENO+'
  :/opt/start.sh:2+set -x
  :/opt/start.sh:2+:
  :/opt/start.sh:3+set -euo pipefail
  :/opt/start.sh:4+IFS='
      '
  /opt/start.sh: line 6: DATABASE_CONFIG_OBJECT: unbound variable
  </code></pre>