title: Kubernetes fails to deploy valid container image
body: <p>I have a docker image containing an NodeJS app. The Dockerfile is:</p>
  
  <pre><code>FROM node:8
  WORKDIR /app
  ADD . /app
  RUN npm install
  EXPOSE 80
  ENTRYPOINT [ "/bin/sh", "./start.sh" ]
  </code></pre>
  
  <p>The start.sh script is:</p>
  
  <pre><code>#!/bin/bash
  ...
  echo "Starting application"
  npm start
  </code></pre>
  
  <p>I'm able to launch and test the image manually:</p>
  
  <pre><code>$ gcloud docker -- run -it --rm my-container
  ...
  Starting application
  ...
  &gt; node index.js
  ...
  </code></pre>
  
  <p>The same container is used by a kubernetes deployment:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  ...
  spec:
    ...
    template:
      ...
      spec:
        containers:
        - image: my-container
  ...
  </code></pre>
  
  <p>The container starts, the <code>start.sh</code> script is correctly executed but it terminates and the container goes into a <code>CrashLoopBackOff</code> loop.</p>
  
  <p>After inspecting the pod manually:</p>
  
  <pre><code>kubectl exec -ti my-pod -- bash
  I have no name!@my-pod:/app# cat /etc/passwd
  ... empty response
  </code></pre>
  
  <p>-> <strong><em>It appears that somehow there are no system users on the container, which makes most commands (like <code>npm</code>) fail silently and terminate the container</em></strong></p>
  
  <p>I have also tried, without success:</p>
  
  <ul>
  <li>deleting the pod</li>
  <li>deleting and re-creating the deployment</li>
  <li>running the <code>node</code> image with the <code>node</code> user -> <code>unable to find user node: no matching entries in passwd file</code></li>
  </ul>
  
  <p>Last note: I actually have many deployments (using the same template with just a different name) which are running fine with an image that was built a few days ago <strong><em>with the same source code</em></strong>.</p>
  
  <p>For some deployments, it actually worked after manually deleting the pod and letting kubernetes recreate it.</p>
  
  <p>Any ideas?</p>
  
  <p><strong><em>Edit 18/01/2018</em></strong> I have tried rebuilding an image with the same source code that old working images use, without success. I have also tried a simpler Dockerfile:</p>
  
  <pre><code>FROM node:8
  USER node
  </code></pre>
  
  <p>But I still get an error related to the fact that no users seem to be there:</p>
  
  <pre><code>Error response from daemon: {"message":"linux spec user: unable to find user node: no matching entries in passwd file"}
  </code></pre>
  
  <p>I have checked with the docker-node guys, the image hasn't changed recently. Could it be related to kubernetes changes? Keep it mind that my images <strong><em>do run</em></strong> when I run them manually with the docker command.</p>