title: Why might the host behave more deterministic than a docker container?
body: <p>We use Docker to well define the build environment and help with deterministic builds but on my machine I get a tiny change in the build results using Docker but not when not using Docker.</p>
  
  <p>I did pretty extensive testing and am out of ideas :(</p>
  
  <p>I tested on the following systems:</p>
  
  <ul>
  <li><strong>A</strong>: My new PC without Docker</li>
  <li><strong>AD1</strong>: My new PC with Docker, using our Dockerfile based on ubuntu:18.04 compiled "a year ago"</li>
  <li><strong>AD2</strong>: My new PC with Docker, using our Dockerfile based on ubuntu:19:10 compiled now</li>
  <li><strong>B</strong>: My laptop (that I had copied the disk from to my new PC) without Docker</li>
  <li><strong>BD</strong>: My laptop with Docker</li>
  <li><strong>CD1</strong>: Co-worker's laptop with Docker, using our Dockerfile based on ubuntu:18.04 compiled "a year ago"</li>
  <li><strong>CD2</strong>: Co-worker's laptop with Docker, using our Dockerfile based on ubuntu:19:10 compiled now</li>
  <li><strong>DD</strong>: A Digital Ocean VPS with our Dockerfile based on ubuntu:18.04 compiled now</li>
  </ul>
  
  <p>In all scenarios we got either of two build results I will name variant X and Y.</p>
  
  <ul>
  <li>We got variant X using A, B, CD1, CD2 and DD.</li>
  <li>We got variant Y using AD1, AD2 and BD.</li>
  </ul>
  
  <p>The issue keeps being 100% reproducible since several releases of our Android app. It did not go away when I updated my Docker from 19.03.6 to 19.03.8 to match my co-worker's version. We both had Ubuntu 19.10 back then and I now keep getting the issue with Ubuntu 20.04.</p>
  
  <p>I always freshly cloned our project into a new folder, used disorderfs to eliminate file system sorting issues and mounted the folder into the docker container.</p>
  
  <p>I doubt it's relevant but we are using this Dockerfile:</p>
  
  <pre><code>FROM ubuntu:18.04
  
  RUN dpkg --add-architecture i386 &amp;&amp; \
      apt-get update -y &amp;&amp; \
      apt-get install -y software-properties-common &amp;&amp; \
      apt-get update -y &amp;&amp; \
      apt-get install -y wget \
              openjdk-8-jre-headless=8u162-b12-1 \
              openjdk-8-jre=8u162-b12-1 \
              openjdk-8-jdk-headless=8u162-b12-1 \
              openjdk-8-jdk=8u162-b12-1 \
              git unzip &amp;&amp; \
      rm -rf /var/lib/apt/lists/* &amp;&amp; \
      apt-get autoremove -y &amp;&amp; \
      apt-get clean
  
  # download and install Android SDK
  ARG ANDROID_SDK_VERSION=4333796
  ENV ANDROID_HOME /opt/android-sdk
  RUN mkdir -p /opt/android-sdk &amp;&amp; cd /opt/android-sdk &amp;&amp; \
      wget -q https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip &amp;&amp; \
      unzip *tools*linux*.zip &amp;&amp; \
      rm *tools*linux*.zip &amp;&amp; \
      yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
  </code></pre>
  
  <p>Also <a href="https://github.com/mycelium-com/wallet-android/blob/master/README.md#deterministic-builds" rel="noreferrer">here</a> are the build instructions I run and get different results. The diff itself is can be found <a href="https://gitlab.com/walletscrutiny/walletScrutinyCom/blob/73e728868398ecc3c370d0d12ff00f24c6c97e30/_posts/2019-12-20-com.mycelium.wallet.md" rel="noreferrer">here</a>.</p>
  
  <hr>
  
  <p>Edit: I also filed it as a <a href="https://github.com/docker/for-linux/issues/1018" rel="noreferrer">bug on the docker repo</a>.</p>