title: Running Chromium inside Docker - Gtk: cannot open display: :0
body: <p>When I try to run chromium inside a docker container I see the following error: Gtk: cannot open display: :0</p>
  
  <p>Dockerfile: (based on <a href="https://registry.hub.docker.com/u/jess/chromium/dockerfile" rel="noreferrer">https://registry.hub.docker.com/u/jess/chromium/dockerfile</a>)</p>
  
  <pre><code>FROM debian:jessie
  
  # Install Chromium
  RUN sed -i.bak 's/jessie main/jessie main contrib non-free/g' /etc/apt/sources.list &amp;&amp; \
      apt-get update &amp;&amp; apt-get install -y \
      chromium \
      chromium-l10n \
      libcanberra-gtk-module \
      libexif-dev \
      libpango1.0-0 \
      libv4l-0 \
      pepperflashplugin-nonfree \                                                                          
      --no-install-recommends &amp;&amp; \
      mkdir -p /etc/chromium.d/
  
  # Autorun x11vnc
  CMD ["/usr/bin/chromium", "--no-sandbox", "--user-data-dir=/data"]
  </code></pre>
  
  <p>build and run:</p>
  
  <pre><code>docker build -t chromium
  docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --privileged chromium
  </code></pre>
  
  <p>and the error:</p>
  
  <pre><code>[1:1:0202/085603:ERROR:browser_main_loop.cc(164)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
  No protocol specified
  [1:1:0202/085603:ERROR:browser_main_loop.cc(210)] Gtk: cannot open display: :0
  </code></pre>