title: Is there any way to run "pkexec" from a docker container?
body: <p>I am trying to set up a Docker image (my Dockerfile is available here, sorry for the french README: <a href="https://framagit.org/Gwendal/firefox-icedtea-docker" rel="nofollow noreferrer">https://framagit.org/Gwendal/firefox-icedtea-docker</a>) with an old version of Firefox and an old version of Java to run an old Java applet to start a VPN. My image does work and successfully allows me to start the Java applet in Firefox.</p>
  
  <p>Unfortunately, the said applet then tries to run the following command in the container (I've simply removed the <code>--config</code> part from the command as it does not matter here):</p>
  
  <pre><code>INFO: launching '/usr/bin/pkexec sh -c /usr/sbin/openvpn --config ...'
  </code></pre>
  
  <p>Then the applet exits silently with an error. While investigating, I've tried running a command with <code>pkexec</code> with the same Docker image, and it gives me this result:</p>
  
  <pre><code>$ sudo docker-compose run firefox pkexec /firefox/firefox-sdk/bin/firefox-bin -new-instance
  **
  ERROR:pkexec.c:719:main: assertion failed: (polkit_unix_process_get_start_time (POLKIT_UNIX_PROCESS (subject)) &gt; 0)
  </code></pre>
  
  <p>But I don't know polkit at all and cannot understand this error.</p>
  
  <hr>
  
  <p><strong>EDIT: A more minimal way to reproduce the problem is with this Dockerfile:</strong></p>
  
  <pre><code>FROM ubuntu:16.04
  
  RUN apt-get update \
      &amp;&amp; apt-get install -y policykit-1
  </code></pre>
  
  <p>And then run:</p>
  
  <pre><code>$ sudo docker build -t pkexec-test .
  $ sudo docker run pkexec-test pkexec echo Hello
  </code></pre>
  
  <p>Which leads here again to:</p>
  
  <pre><code>ERROR:pkexec.c:719:main: assertion failed: (polkit_unix_process_get_start_time (POLKIT_UNIX_PROCESS (subject)) &gt; 0)
  </code></pre>
  
  <hr>
  
  <p><strong>Should I conclude that <code>pkexec</code> cannot work in a docker container? Or is there any way to make this command work?</strong></p>
  
  <p><em>Sidenote</em>: I have no control whatsoever on the Java applet that I try to run, it is a horrible and very dated proprietary black box that I am supposed to use at work, for which I have no access to the source code, and that I must use as is.</p>