title: Failed to fetch ........... Hash Sum mismatch
body: <h3>Environment</h3>
  
  <ul>
  <li>OS: Windows 10</li>
  <li>Docker Version: 2.1.0.3 Stable Desktop Community</li>
  <li>Docker Compose Version: 1.24.1</li>
  </ul>
  
  <h3>Dockerfile</h3>
  
  <pre><code>FROM postgres:11
  
  COPY ./99fixbadproxy /etc/apt/apt.conf.d/99fixbadproxy
  
  RUN apt-get -y update \
    &amp;&amp; apt-get install -y \
      build-essential \
      python3-dev \
      python-gdal \
      libxml2 \
      libgeos-dev \
      libproj12 \
      postgresql-server-dev-11 \
      postgresql-11-postgis-2.5 \
      postgresql-11-postgis-scripts \
    &amp;&amp; apt-get clean \
    &amp;&amp; rm -rf /var/lib/apt/lists/*
  
  ADD ./init /docker-entrypoint-initdb.d/
  </code></pre>
  
  99fixbadproxy
  
  <pre><code>Acquire::http::Pipeline-Depth 0;
  Acquire::http::No-Cache true;
  Acquire::BrokenProxy    true;
  </code></pre>
  
  <h3>Docker commands that I executed</h3>
  
  <p><code>docker-compose build db</code></p>
  
  <h3>Actual result</h3>
  
  <pre><code>Building db
  Step 1/4 : FROM postgres:11
   ---&gt; e2d75d1c1264
  Step 2/4 : COPY ./99fixbadproxy /etc/apt/apt.conf.d/99fixbadproxy
   ---&gt; Using cache
   ---&gt; 5448c38eae1c
  Step 3/4 : RUN apt-get -y update   &amp;&amp; apt-get install -y     build-essential     python3-dev     python-gdal     libxml2     libgeos-dev     libproj12     postgresql-server-dev-11     postgresql-11-postgis-2.5     postgresql-11-postgis-scripts   &amp;&amp; apt-get clean   &amp;&amp; rm -rf /var/lib/apt/lists/*
   ---&gt; Running in d930ce46b46e
  Ign:1 http://deb.debian.org/debian stretch InRelease
  Get:2 http://apt.postgresql.org/pub/repos/apt stretch-pgdg InRelease [51.4 kB]
  Get:3 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
  Get:4 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
  Get:5 http://deb.debian.org/debian stretch Release [118 kB]
  Get:6 http://apt.postgresql.org/pub/repos/apt stretch-pgdg/main amd64 Packages [184 kB]
  Get:7 http://deb.debian.org/debian stretch-updates/main amd64 Packages [27.4 kB]
  Get:8 http://deb.debian.org/debian stretch Release.gpg [2,365 B]
  Get:9 http://deb.debian.org/debian stretch/main amd64 Packages [7,086 kB]
  Get:10 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [497 kB]
  Err:10 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
    Hash Sum mismatch
    Hashes of expected file:
     - Filesize:497208 [weak]
     - SHA256:2c51a7b9197719053220fc1d4c38453a48582d0190953481c0cd9620b8844a00
     - SHA1:6599fb50a02b4f3abe280b0bbfd42ba6227ae7d4 [weak]
     - MD5Sum:23a00a02efd96accdf62f7e6d27ee44b [weak]
    Hashes of received file:
     - SHA256:e8bb756eb3dae9f84b1ff2623bc3ff058e02775f60082cf1583ef789214a4a53
     - SHA1:b8fa8ff140603cb7b64f8f214957f35d1f85b987 [weak]
     - MD5Sum:fbb52af7168bde493aa4d9e6b65c6e34 [weak]
     - Filesize:497208 [weak]
    Last modification reported: Wed, 25 Sep 2019 06:37:02 +0000
    Release file created at: Thu, 26 Sep 2019 04:11:51 +0000
  Fetched 8,151 kB in 7s (1,106 kB/s)
  Reading package lists...
  E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-amd64/by-hash/SHA256/2c51a7b9197719053220fc1d4c38453a48582d0190953481c0cd9620b8844a00  Hash Sum mismatch
     Hashes of expected file:
      - Filesize:497208 [weak]
      - SHA256:2c51a7b9197719053220fc1d4c38453a48582d0190953481c0cd9620b8844a00
      - SHA1:6599fb50a02b4f3abe280b0bbfd42ba6227ae7d4 [weak]
      - MD5Sum:23a00a02efd96accdf62f7e6d27ee44b [weak]
     Hashes of received file:
      - SHA256:e8bb756eb3dae9f84b1ff2623bc3ff058e02775f60082cf1583ef789214a4a53
      - SHA1:b8fa8ff140603cb7b64f8f214957f35d1f85b987 [weak]
      - MD5Sum:fbb52af7168bde493aa4d9e6b65c6e34 [weak]
      - Filesize:497208 [weak]
     Last modification reported: Wed, 25 Sep 2019 06:37:02 +0000
     Release file created at: Thu, 26 Sep 2019 04:11:51 +0000
  E: Some index files failed to download. They have been ignored, or old ones used instead.
  ERROR: Service 'db' failed to build: The command '/bin/sh -c apt-get -y update   &amp;&amp; apt-get install -y     build-essential     python3-dev     python-gdal     libxml2     libgeos-dev     libproj12     postgresql-server-dev-11     postgresql-11-postgis-2.5     postgresql-11-postgis-scripts   
  &amp;&amp; apt-get clean   &amp;&amp; rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100
  </code></pre>
  
  <h3>Expected outcome</h3>
  
  <pre><code>Successfully built
  </code></pre>
  
  <p>This image perfectly work fine in any distro of Linux, I have tested in Ubuntu, Debian, Arch Linux. And I didn't even included Step 2. </p>
  
  <p>I added step 2 according to following link but unfortunately it didn't work for me.
  <a href="https://github.com/jenkinsci/docker/issues/543" rel="nofollow noreferrer">https://github.com/jenkinsci/docker/issues/543</a></p>
  
  <h3>Output of <code>docker version</code></h3>
  
  <p>Client: Docker Engine - Community
   Version:           19.03.2
   API version:       1.40
   Go version:        go1.12.8
   Git commit:        6a30dfc
   Built:             Thu Aug 29 05:26:49 2019
   OS/Arch:           windows/amd64
   Experimental:      false</p>
  
  <p>Server: Docker Engine - Community
   Engine:
    Version:          19.03.2
    API version:      1.40 (minimum version 1.12)
    Go version:       go1.12.8
    Git commit:       6a30dfc
    Built:            Thu Aug 29 05:32:21 2019
    OS/Arch:          linux/amd64
    Experimental:     false
   containerd:
    Version:          v1.2.6
    GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
   runc:
    Version:          1.0.0-rc8
    GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
   docker-init:
    Version:          0.18.0
    GitCommit:        fec3683</p>
  
  <h3>Other relevant information</h3>
  
  <ul>
  <li>I tried both automatic and fixed DNS Server settings.</li>
  <li>I tried exposing daemon on tcp without TLS checked and unchecked, thinking could be the issue of networking.</li>
  <li>My proxies is disabled.</li>
  <li>I tried with other debian based image and added apt-get update line. However, it doesn't seem s to work anywhere.</li>
  </ul>