moby: Hash Sum mismatch on Ubuntu 16.04 apt-get update

Description

apt-get update fails on fresh Ubuntu image

Steps to reproduce the issue:

  1. create the following dockerfile:
FROM ubuntu:16.04
MAINTAINER b@example.com
RUN apt-get clean \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get update -y 
  1. Run it: docker build .

Describe the results you received: Error:

E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/source/by-hash/SHA256/50ccff6c903e98e2e52c1ab6dae4a85d23a84369325fd971c4bfc3752e6a7ede  Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.

Describe the results you expected: No error.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Docker version 1.12.6, build 78d1802

Output of docker info:

Containers: 2
 Running: 0
 Paused: 0
 Stopped: 2
Images: 3
Server Version: 1.12.6
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 10
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge null host overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor seccomp
Kernel Version: 4.4.0-59-generic
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.796 GiB
Name: ubuntu16vm
ID: OHBW:TZ6D:RDGR:LMIR:NJTP:76J6:3PUF:FFJ2:GT4C:SDRI:CND5:RW5H
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
 127.0.0.0/8

Additional environment details (AWS, VirtualBox, physical, etc.): Ubuntu 16.04 VirtualBox VM on Windows 10 host

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

This resolves the issue for Ubuntu 16.04 hash sum mismatch: sudo apt-get update -o Acquire::CompressionTypes::Order::=gz sudo apt-get upgrade -y sudo apt-get update

hi Richard please that its really solve the issue by Hash Sum mismatch

FROM ubuntu:16.04 MAINTAINER b@example.com RUN touch /etc/apt/apt.conf.d/99fixbadproxy
&& echo “Acquire::http::Pipeline-Depth 0;” >> /etc/apt/apt.conf.d/99fixbadproxy
&& echo “Acquire::http::No-Cache true;” >> /etc/apt/apt.conf.d/99fixbadproxy
&& echo “Acquire::BrokenProxy true;” >> /etc/apt/apt.conf.d/99fixbadproxy
&& apt-get update -o Acquire::CompressionTypes::Order::=gz
&& apt-get clean
&& rm -rf /var/lib/apt/lists/*
&& apt-get update -y

Thanks.

I’ve tried adding all 3 solutions in that question below (and deleting all Docker images every time) but I still get the same error. I’m not behind any proxy I’m aware of. I guess it must be a bug in Ubuntu, I’ll log it there.

FROM ubuntu:16.04
MAINTAINER b@example.com
RUN touch /etc/apt/apt.conf.d/99fixbadproxy \
    && echo "Acquire::http::Pipeline-Depth 0;" >> /etc/apt/apt.conf.d/99fixbadproxy \
    && echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99fixbadproxy \
    && echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99fixbadproxy \
    && apt-get update -o Acquire::CompressionTypes::Order::=gz \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get update -y

Insert this command before apt-get update

RUN sed -i 's/archive.ubuntu.com/kr.archive.ubuntu.com/g' /etc/apt/sources.list

It worked for my ubuntu 16.04

This does not look like a bug in docker, but either a networking issue, or possibly a mirror of archive.ubuntu.com being out of date. Are you possibly behind a caching proxy? (also see http://askubuntu.com/questions/41605/trouble-downloading-packages-list-due-to-a-hash-sum-mismatch-error)

I am not able to reproduce this issue, and given that you are successfully able to run apt-get in an ubuntu 14.04 container, I don’t suspect there’s a bug at hand here, so I’ll close this issue, but feel free to continue the conversation 👍

Additionally, 14.04 works fine. I’ll use that as a workaround for now.