title: Kubernetes/Docker error after building on Macbook M1 - standard_init_linux.go:211: exec user process caused “exec format error”
body: <p>I'm getting the subject error when deploying my application to Kubernetes on Google Cloud.</p>
  <p>From digging through this post - <a href="https://stackoverflow.com/questions/58298774/standard-init-linux-go211-exec-user-process-caused-exec-format-error">standard_init_linux.go:211: exec user process caused &quot;exec format error&quot;</a> - it seems like the problem may be caused by the fact I'm building on a Macbook M1.</p>
  <p>The proposed solution was to build on another machine.</p>
  <p>Does anyone know of an alternative solution to this?  I'd rather not have to change my machine just to get around this problem.</p>
  <p>Here are the logs output with <code>kubectl logs</code></p>
  <pre><code>Events:
    Type     Reason     Age                From               Message
    ----     ------     ----               ----               -------
    Normal   Scheduled  45s                default-scheduler  Successfully assigned default/api-6dd8df46dd-gfpvh to gke-mysite-staging-general-pool-d0c2609f-ljd9
    Normal   Pulled     38s                kubelet            Successfully pulled image &quot;gcr.io/mysite/mysite-api/staging&quot; in 4.51688779s
    Normal   Pulled     36s                kubelet            Successfully pulled image &quot;gcr.io/mysite/mysite-api/staging&quot; in 187.266825ms
    Normal   Pulling    18s (x3 over 42s)  kubelet            Pulling image &quot;gcr.io/mysite/mysite-api/staging&quot;
    Normal   Created    18s (x3 over 37s)  kubelet            Created container api
    Normal   Started    18s (x3 over 36s)  kubelet            Started container api
    Normal   Pulled     18s                kubelet            Successfully pulled image &quot;gcr.io/mysite/mysite-api/staging&quot; in 194.129326ms
    Warning  BackOff    1s (x6 over 35s)   kubelet            Back-off restarting failed container
  </code></pre>
  <p>Dockerfile</p>
  <pre><code>FROM ruby:2.7.0
  
  ARG environment
  
  ENV RAILS_ENV $environment
  
  RUN apt-get update -qq &amp;&amp; \
    DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
    build-essential \
    make \
    gcc \
    g++ \
    libxml2-dev \
    libxslt-dev \
    pkg-config \
    libcurl3-dev \
    libpq-dev \
    nodejs \
    cron \
    libgmp3-dev &amp;&amp; \
    apt-get clean &amp;&amp; \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  
  RUN mkdir /home/app
  WORKDIR /home/app
  COPY ./Gemfile /home/app/Gemfile
  COPY ./Gemfile.lock /home/app/Gemfile.lock
  RUN bundle update --bundler
  RUN bundle install
  COPY ./ /home/app
  
  EXPOSE 3000
  
  # Start the main process.
  CMD [&quot;rails&quot;, &quot;server&quot;, &quot;-b&quot;, &quot;0.0.0.0&quot;]
  </code></pre>
  <p>Deployment is done with Helm:- <code>helm upgrade mysite-api . -f values.yaml</code></p>
  <pre><code>replicaCount: 1
  
  app_version: &quot;0.1&quot;
  
  deployments:
    mysite_api:
      image: gcr.io/mysite/mysite-api/staging
      pullPolicy: Always
      name: api
      label: api
      replicas: 1
      port: 3000
      nodepool: general-pool
      command: '[&quot;bundle&quot;, &quot;exec&quot;, &quot;puma&quot;, &quot;-C&quot;, &quot;config/puma.rb&quot;]'
  
  services:
    - name: api
      label: api
      port_container: 3000
      port_service: 3000
      type: NodePort
      selector: app
      selector_value: api
  
  autoscaling:
    - name: api
      label: api
      deployment: api
      enabled: true
      minReplicas: 1
      maxReplicas: 3
      targetCPUUtilizationPercentage: 80
      targetMemoryUtilizationPercentage: 80
  </code></pre>