<p>My Kubernetes deployment is failing. Can anybody advise what could be going wrong.</p>
<p>My observation: When I remove the volume mount things the service bounce back</p>
<pre><code>   volumeMounts:
            - name: my-volume
              mountPath: /app
      volumes:
       - name: my-volume
         hostPath:
          path: /tmp/vpath 
</code></pre>
<p>Remove the above piece of the code</p>
<pre><code>  State:          Waiting
  Reason:       CrashLoopBackOff
  Last State:     Terminated
  Reason:       ContainerCannotRun
  Message:      OCI runtime create failed: container_linux.go:380: starting container process caused: exec: &quot;./main&quot;: stat ./main: no such file or directory: unknown
 
</code></pre>
<p>Here is my deployment file</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert -f docker-compose.yml
    kompose.version: 1.22.0 (955b78124)
  creationTimestamp: null
  labels:
    io.kompose.service: stservice
  name: stservice
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: stservice
  strategy: {}
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert -f docker-compose.yml
        kompose.version: 1.22.0 (955b78124)
      creationTimestamp: null
      labels:
        io.kompose.service: stservice
    spec:
      containers:
        - image: stservice
          name: stservice
          imagePullPolicy: Never
          ports:
            - containerPort: 5001
            - containerPort: 5002
          volumeMounts:
            - name: my-volume
              mountPath: /app
      volumes:
       - name: my-volume
         hostPath:
          path: /tmp/vpath 
status: {}


apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: kompose convert -f docker-compose.yml
    kompose.version: 1.22.0 (955b78124)
  creationTimestamp: null
  labels:
    io.kompose.service: stservice
  name: stservice
spec:
  ports:
    - name: &quot;5001&quot;
      port: 5001
      targetPort: 5001
    - name: &quot;5002&quot;
      port: 5002
      targetPort: 5002
  selector:
    io.kompose.service: stservice
status:
  loadBalancer: {}
</code></pre>
<p>Can anyone advice why having volume mount causes this failure</p>
<pre><code>Message:      OCI runtime create failed: container_linux.go:380: starting container process caused: exec: &quot;./main&quot;: stat ./main: no such file or directory: unknown
</code></pre>

EagerLearner
<p>I think you might be mounting the volume over the Dockerfile <strong>WORKDIR</strong>, so you are overwriting the file that it is looking for and throwing this error: &quot;... /main: no such file or directory:&quot;.</p>
<p>If that is the issue update the docker WORKDIR or the mount path. If that is not the issue please include the Dockerfile.</p>
