title: Wine not running on Google Cloud Run (limitations of google cloud run)
body: <p>This is my docker file, which is installing wine in order to run some exes that I want to, on Google cloud run:</p>
  <pre><code>ARG BASE_IMAGE=&quot;ubuntu&quot;
  ARG TAG=&quot;latest&quot;
  FROM ${BASE_IMAGE}:${TAG}
  
  # Install prerequisites
  RUN apt-get update \
      &amp;&amp; DEBIAN_FRONTEND=&quot;noninteractive&quot; apt-get install -y --no-install-recommends \
          apt-transport-https \
          ca-certificates \
          cabextract \
          git \
          gosu \
          gpg-agent \
          p7zip \
          pulseaudio-utils \
          software-properties-common \
          tzdata \
          unzip \
          wget \
          winbind \
          xvfb \
          zenity \
      &amp;&amp; rm -rf /var/lib/apt/lists/*
  
  # Install wine
  ARG WINE_BRANCH=&quot;stable&quot;
  RUN wget -O- -nv https://dl.winehq.org/wine-builds/winehq.key | apt-key add - \
      &amp;&amp; apt-add-repository &quot;deb https://dl.winehq.org/wine-builds/ubuntu/ $(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2) main&quot; \
      &amp;&amp; dpkg --add-architecture i386 \
      &amp;&amp; apt-get update \
      &amp;&amp; DEBIAN_FRONTEND=&quot;noninteractive&quot; apt-get install -y --install-recommends winehq-${WINE_BRANCH} \
      &amp;&amp; rm -rf /var/lib/apt/lists/*
  
  # Install winetricks
  RUN wget -nv https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks -O /usr/bin/winetricks \
      &amp;&amp; chmod +x /usr/bin/winetricks
  
  # Download gecko and mono installers
  COPY download_gecko_and_mono.sh /root/download_gecko_and_mono.sh
  RUN chmod +x /root/download_gecko_and_mono.sh \
      &amp;&amp; /root/download_gecko_and_mono.sh &quot;$(dpkg -s wine-${WINE_BRANCH} | grep &quot;^Version:\s&quot; | awk '{print $2}' | sed -E 's/~.*$//')&quot;
  
  RUN apt-get update
  RUN apt-get install -y python3.6 python3-pip
  RUN pip3 install flask gunicorn
  RUN apt-get install -y nginx
  COPY . /app
  
  WORKDIR /app
  RUN chmod a+x /usr/bin/wine
  ENTRYPOINT [&quot;/usr/local/bin/gunicorn&quot;,&quot;-w&quot;,&quot;1&quot;,&quot;--timeout&quot;,&quot;900&quot;,&quot;-b&quot;,&quot;0.0.0.0:8005&quot;,&quot;app:app&quot;]
  EXPOSE 8005
  </code></pre>
  <p>I have tested this container locally on my linux 64 bit machine, and it is able to run the wine commands (app.py is a flask server that calls exes).
  But when I try to call &quot;wine&quot; on the GCR container (I even tried calling it at the beginning of my app.py, which is guaranteed to run), I get this error:</p>
  <pre><code>Traceback (most recent call last): File &quot;/usr/local/lib/python3.8/dist-packages/gunicorn/arbiter.py&quot;, line 583, in spawn_worker worker.init_process() File &quot;/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base.py&quot;, line 119, in init_process self.load_wsgi() File &quot;/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base.py&quot;, line 144, in load_wsgi self.wsgi = self.app.wsgi() File &quot;/usr/local/lib/python3.8/dist-packages/gunicorn/app/base.py&quot;, line 67, in wsgi self.callable = self.load() File &quot;/usr/local/lib/python3.8/dist-packages/gunicorn/app/wsgiapp.py&quot;, line 49, in load return self.load_wsgiapp() File &quot;/usr/local/lib/python3.8/dist-packages/gunicorn/app/wsgiapp.py&quot;, line 39, in load_wsgiapp return util.import_app(self.app_uri) File &quot;/usr/local/lib/python3.8/dist-packages/gunicorn/util.py&quot;, line 358, in import_app mod = importlib.import_module(module) File &quot;/usr/lib/python3.8/importlib/__init__.py&quot;, line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1014, in _gcd_import File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 991, in _find_and_load File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 975, in _find_and_load_unlocked File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 671, in _load_unlocked File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 783, in exec_module File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed File &quot;/app/app.py&quot;, line 27, in &lt;module&gt; print(subprocess.call([&quot;wine&quot;]) File &quot;/usr/lib/python3.8/subprocess.py&quot;, line 340, in call with Popen(*popenargs, **kwargs) as p: File &quot;/usr/lib/python3.8/subprocess.py&quot;, line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File &quot;/usr/lib/python3.8/subprocess.py&quot;, line 1702, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 8] Exec format error: 'wine'
  </code></pre>
  <p>The important line in the error being:</p>
  <pre><code>OSError: [Errno 8] Exec format error: 
  </code></pre>
  <p>It is particularly odd because I would assume docker would guarantee portability across linux platforms.</p>
  <h1>EDIT:</h1>
  <p>The original issue was that I was not using wine64 (gcr only supports linux 64 bit binaries ), which resolved the original issue of wine running.</p>
  <p>However, due to Cloud Run fully managed using gVisor sandbox, it was still not possible to get my exe running.
  I have eventually moved to other approaches to solve my problem.</p>