<p>I am trying to start Webpack Dev Server in a Rails app on a Digital Ocean Kubernetes Cluster. I can't figure out the correct command. The app works in Docker locally.</p>

<p>I keep getting errors like this:</p>

<blockquote>
  <p>Error: failed to start container "exactpos-webpack": Error response from
  daemon: OCI runtime create failed: container_linux.go:348: starting
  container process caused "exec: \"bin/bash\": stat bin/bash: no such
  file or directory": unknown Back-off restarting failed container</p>
</blockquote>

<p>Here is the code from my docker-compose.yml file:</p>

<pre><code>webpack_dev_server: build: .
command: ./bin/webpack-dev-server 
ports:
- 3035:3035 
volumes:
- .:/usr/src/app
- gem_cache:/gems 
env_file:
- .env/development/web
- .env/development/database environment:
- WEBPACKER_DEV_SERVER_HOST=0.0.0.0
</code></pre>

<p>Here is my kubectl deployment yaml file:</p>

<pre><code>---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: exactpos-webpack
spec:
  replicas: 1
  minReadySeconds: 150
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1  
  selector:
    matchLabels: 
      app: exactpos-webpack
      tier: webpack
  template:
    metadata:
      name: exactpos-webppack
      labels:
        app: exactpos-webpack
        tier: webpack
    spec:
      imagePullSecrets:
        - name: dockerhub-cred
      containers:             
        - name: exactpos-webpack
          image: index.docker.io/markhorrocks/exactpos_webpacker_dev_server:prod
          command: ["bin/bash","-c", "./bin/webpack_dev_server"]
          imagePullPolicy: Always
          ports:
            - containerPort: 3500       
          readinessProbe:
            tcpSocket:
              port: 3500
            initialDelaySeconds: 150
            timeoutSeconds: 5
            periodSeconds: 5
            failureThreshold: 10
          livenessProbe:
            tcpSocket:
              port: 3500
            initialDelaySeconds: 120
            timeoutSeconds: 5
            periodSeconds: 5
            failureThreshold: 10
          env:
          - name: RAILS_LOG_TO_STDOUT
            value: "true"
          - name: RAILS_SERVE_STATIC_FILES
            value: "true"
          - name: DATABASE_NAME
            value: "exactpos_production"
          - name: DATABASE_PORT
            value: "5432"
          - name: DATABASE_URL
            value: "postgres"
          - name: DATABASE_USER
            valueFrom:
              secretKeyRef:
                name: "db-user"
                key: "username"
          - name: DATABASE_PASSWORD
            valueFrom:
              secretKeyRef:
                name: "db-user-pass"
                key: "password"
          - name: REDIS_URL
            value: "redis"
          - name: REDIS_PORT
            value: "6379"
          - name: RAILS_ENV
            value: "production"
          - name: WEBPACKER_DEV_SERVER_HOST
            value: "0.0.0.0"
          - name: SECRET_KEY_BASE
            valueFrom:
              secretKeyRef:
                name: "secret-key-base"
                key: "secret-key-base"
</code></pre>

markhorrocks
<p>Your deployment.yaml has following :</p>

<pre><code>command: ["bin/bash","-c", "./bin/webpack_dev_server"]
</code></pre>

<p>There is no <code>bin/bash</code> present in docker image. It should be like:</p>

<pre><code>command: ["/bin/bash","-c", "./bin/webpack_dev_server"]
</code></pre>

<p>I believe, it will resolve your problem.</p>

<p>EDIT1: I again looked at your docker-compose.yml file and see the following line:</p>

<pre><code>volumes:
- .:/usr/src/app
</code></pre>

<p>It means at run time of docker you copied all the files from <code>.</code> directory to <code>/usr/src/app</code>. Is the <code>config/webpacker.yml</code> was present at that location? OR you overlayed <code>/usr/src/app</code> from whatever it was in <code>.</code> directory at the run time. Could you please share DockerFile of your app as well to better understanding?</p>
