My Docker image builds repeatedly keep failing with one of the following two errors:
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/main/binary-amd64/by-hash/SHA256/ff7fd80e902a1acfba06e7b513711da31abe915d95b3ba39ce198e02efd209e5 Hash Sum mismatch
Hashes of expected file:
- Filesize:1343916 [weak]
- SHA256:ff7fd80e902a1acfba06e7b513711da31abe915d95b3ba39ce198e02efd209e5
- SHA1:edd753d5bd860c126016feca4e898a736999915b [weak]
- MD5Sum:9f666ceefac581815e5f3add8b30d3b9 [weak]
Hashes of received file:
- SHA256:e243776bf91c4d182410fe03e2b925c9fcfead68718b4caa09d20e8e46cf7c95
- SHA1:d7625072bd6ad2f0f5c9af714088954624914361 [weak]
- MD5Sum:14d1513c9ae5124fd53e092c82c408f8 [weak]
- Filesize:1343916 [weak]
Last modification reported: Thu, 26 Apr 2018 17:43:25 +0000
Release file created at: Thu, 26 Apr 2018 23:37:48 +0000
E: Some index files failed to download. They have been ignored, or old ones used instead.
If I keep trying to build the image repeatedly, I'll get past that maybe 50% of the time only for it to die with the following error:
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/b/boost1.65.1/libboost-wave1.65-dev_1.65.1+dfsg-0ubuntu5_amd64.deb 403 Forbidden [IP: 91.189.88.24 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
What's going on here? How do I fix these issues and get my docker image build to apt-get
without errors? For what it's worth, I don't have these problems if I use ubuntu:16.04 as my base image (instead of ubuntu:18.04).
% docker build --network=host -t myimage:v18.04
FROM ubuntu:18.04
# Configure environment
ENV DEBIAN_FRONTEND=noninteractive \
TZ=America/New_York \
HOME=/root
# Install packages
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install \
automake \
autoconf \
libtool \
make \
curl \
gcc-8 \
g++-8 \
git \
gperf \
libboost-all-dev \
libevent-dev \
libhiredis-dev \
libssl-dev \
libtokyocabinet-dev \
tcsh \
python3-sphinx \
uuid-dev \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# And then other stuff.... But the Docker build never even gets past the previous RUN far.