title: Docker X11 Forward get Blank Screen
body: <p>Im trying to use docker to contain my app and forward x11 to spawn Chrome with chromedriver.
  I could make the browser spawn, but its spawn all blank. Also the context menu its blank. It closes without crashing.</p>
  
  <p>Introductory information: (CAN BE SKIPPED)</p>
  
  <p>I have an app (django+postgresql+supervisor+uwsgi+celery+redis+nginx+selenium) that spawn Chrome/Chromium browsers via Chromedriver with Selenium, opening them in diferent pre-loaded User Data Directories (with pre-loaded sessions and logins) and do some automated stuff in diferents sites.</p>
  
  <p>Everything works smooth and clear in my computer.</p>
  
  <p>Some co-workers ask me to install them my app. I told them it would only work on Linux, since i develop in Linux and im not sure if everything would work same in Windows.</p>
  
  <p>After 1 of them installed Ubuntu, i tried to install everything with my source code, using my private git repo for sharing/updating, and it was extremelly painfull.</p>
  
  <p>First, i had troubles installing the right Python Version, after that, supervisor was not working as i expected. Every step presented diferent troubles, and the app itselft presents some bugs that i dont have in my own environment.</p>
  
  <p>The Trouble itself: (CAN START READING HERE)</p>
  
  <p>So, after a lot of reading, i thought Docker would be fit great, even if its not designed to open desktops apps. A single X11 forward could fix the issue.</p>
  
  <p>I went directly with a Docker-compose file (to speed up the parallel processes setup). This is actually my first time using docker, and its feels really easy. 
  I made to make a Dockerfile and a docker-compose file that setups everything (right python version, chrome/chromedrivers and its dependencies) and everything -excepts Chrome- works great.</p>
  
  <p>After doing some digging and testing with the X11 redirect, i could make my application Launch Chrome and spawn the Chrome windows in my host computer, but the window itselfs its blank. Even if do right click, the opening context menu its all blank.</p>
  
  <p>I ran <code>xhost +local:root</code> on my host computer but that wont fix the issue.</p>
  
  <p>I'vea read here <a href="http://wiki.ros.org/docker/Tutorials/GUI" rel="nofollow noreferrer">http://wiki.ros.org/docker/Tutorials/GUI</a> in the Part 3. The Isolated Way, that i should do something like this </p>
  
  <pre><code>```XSOCK=/tmp/.X11-unix
  XAUTH=/tmp/.docker.xauth
  touch $XAUTH
  xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
  
  docker run -it \
          --volume=$XSOCK:$XSOCK:rw \
          --volume=$XAUTH:$XAUTH:rw \
          --env="XAUTHORITY=${XAUTH}" \
          --env="DISPLAY" \
          -user="myNewUserName" \
      osrf/ros:indigo-desktop-full \
      rqt```
  </code></pre>
  
  <p>But im not sure how should i do the xauth list stuff inside the docker-compose file (or where should i?). Im actually not 100% sure that my issue is inside xauth.</p>
  
  <p>Here is my docker file:
  I choose Python 3.7.4-slim-strech since it:
  * Provides me the right python version
  * Debian can install chromium and chromedriver from its repositories (chromium version 73)
  * Its the most easiest setup that i've found for my needs</p>
  
  <pre><code>
  FROM python:3.7.4-slim-stretch
  
  RUN apt-get update &amp;&amp; apt-get install -y chromium chromedriver build-essential
  
  ENV PYTHONUNBUFFERED 1
  
  # My Actual System Username, i've also tested with other username and i have the same issue
  ENV USERNAME "gabriel"
  
  # These UID and GID match mines
  RUN export uid=1000 gid=1000 &amp;&amp; \
      addgroup \
       --system \
       --gid ${gid} \
         ${USERNAME} &amp;&amp; \
      adduser \
       --system \
       --uid ${uid} \
       --shell /bin/bash \
       --gid ${gid} \
         ${USERNAME} &amp;&amp; \
      usermod -aG sudo ${USERNAME} &amp;&amp; \
      passwd -d ${USERNAME}
  
  RUN mkdir /app &amp;&amp; \
      mkdir /config &amp;&amp; \
      mkdir -p /var/www/static
  
  ADD ./config /config
  RUN pip install -r /config/requirements.pip
  
  RUN chown -R ${uid}:${gid} /app &amp;&amp; \
      chown -R ${uid}:${gid} /config &amp;&amp; \
      chown -R ${uid}:${gid} /var/www &amp;&amp; \
      chmod +x /config/application_launch.sh
  
  USER ${USERNAME}
  ENV HOME /home/${USERNAME}
  
  WORKDIR /app
  
  ADD ./src /app
  </code></pre>
  
  <p>And here is my docker compose file:</p>
  
  <pre><code>
  services:
    db:
      image: postgres
      container_name: ps01
  
    supervisor:
      build: .
      command: supervisord -c /config/supervisord.conf
      volumes:
        - ./src:/app
        - ./src/static:/var/www/static
        - /tmp/.X11-unix:/tmp/.X11-unix:rw
      ports:
        - "9001:9001"
      expose:
        - "8000"
      depends_on:
        - db
      extra_hosts:
        - "yangoo.network:10.68.0.1"
      container_name: su01
      environment:
        - DISPLAY
        - UID
        - QT_X11_NO-MITSHM=1
  
    nginx:
      image: nginx
      container_name: wb01
      ports:
        - "80:80"
      volumes:
        - ./src:/app
        - ./config/nginx:/etc/nginx/conf.d
        - ./src/static:/var/www/static
      depends_on:
        - supervisor
      links:
        - supervisor
  </code></pre>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>Upgrading my distro to popos 19.04 fixed the blank screen issue. Also i could make it work in a Virtual Machine with a newer linux distro. The problem appear to be present only in older distros.</p>