Docker for Mac - Hash Amount Mismatch

I am using Docker for Mac with a Docker file like this (just the beginning):

# Base image
FROM ubuntu:16.04

RUN export DEBIAN_FRONTEND=noninteractive

# Update packages list and system
RUN apt-get -y update;
RUN apt-get -y upgrade

# Allow to use add-apt-repository command
RUN apt-get -y install software-properties-common locales poppler-utils

and after a few days I get the following errors:

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/k/krb5/libk5crypto3_1.13.2+dfsg-5ubuntu2_amd64.deb  Hash Sum mismatch

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/k/keyutils/libkeyutils1_1.5.9-8ubuntu1_amd64.deb  Hash Sum mismatch

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/k/krb5/libkrb5-3_1.13.2+dfsg-5ubuntu2_amd64.deb  Hash Sum mismatch

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/k/krb5/libgssapi-krb5-2_1.13.2+dfsg-5ubuntu2_amd64.deb  Writing more data than expected (206672 > 201874) [IP: 91.189.88.152 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get -y install software-properties-common locales poppler-utils' returned a non-zero code: 100

I used to use Docker for Windows and received such errors, perhaps 1 or 2 times in 2 years, and now on the Mac I get them all the time and can’t create my images.

What could be the reason for this? Do I have to do something on my Mac or change something in my Docker file for it to work?

Just to mark, I also played with such changes:

# Base image
FROM ubuntu:16.04

RUN export DEBIAN_FRONTEND=noninteractive

RUN echo 'Acquire::Acquire-by-hash "yes";' >> /etc/apt/apt.conf
RUN echo 'Acquire::CompressionTypes::Order "gz";' >> /etc/apt/apt.conf

# Update packages list and system
RUN apt-get -y update
RUN apt-get -y clean
RUN apt-get -y upgrade
RUN apt-get -y clean
RUN apt-get dist-upgrade

# Allow to use add-apt-repository command
RUN apt-get -y install software-properties-common locales poppler-utils

or

# Base image
FROM ubuntu:16.04

RUN export DEBIAN_FRONTEND=noninteractive

RUN rm -rf /var/lib/apt/lists/partial
RUN echo 'Acquire::By-Hash "yes";' >> /etc/apt/apt.conf
RUN echo 'Acquire::CompressionTypes::Order:: "gz";' >> /etc/apt/apt.conf

# Update packages list and system
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN apt-get -y clean
RUN apt-get -y upgrade
RUN apt-get -y clean
RUN apt-get dist-upgrade

# Allow to use add-apt-repository command
RUN apt-get -y install software-properties-common
RUN apt-get -y install locales poppler-utils

but that did not change that.

I tested it on Windows and it works fine. The funny thing is that when I change FROM ubuntu:16.04to FROM ubuntu:17.10on MacOS, it will also work without any problems, so it seemed that some packages were taken not from 16.04, but 17.10, when I haveFROM ubuntu:16.04

:

  • Mac
  • Docker
  • reset factory
  • Docker
  • mac49 17.12.0-ce-mac46 (21698)
  • / .

. , MacOS ( 20-30 , ), , , 100 , , , ,

Windows Docker, MacOS, , .

+4
2

, , . , , .

https://launchpad.net/ubuntu/+archivemirrors

,

# Base image 
FROM ubuntu:16.04 

RUN sed -i '1ideb mirror.onet.pl/pub/mirrors/… xenial main' /etc/apt/sources.list 
RUN sed -i '1ideb-src mirror.onet.pl/pub/mirrors/… xenial main' /etc/apt/sources.list 

, , - apt apt-get

RUN apt update && apt upgrade
RUN apt install -y software-properties-common locales poppler-utils

, , - RUN

RUN apt update && apt upgrade && apt install -y software-properties-common locales poppler-utils

, ,

+4

, Ubuntu # 972077, .

-, apt- , . , , , 16.04 17.10.

, , , :

apt-get clean
rm -r /var/lib/apt/lists/*
# The blog below also recommends to change your compression
apt-get update -o Acquire::CompressionTypes::Order::=gz 

. , , . , , , , .

:

Cloud Cloud:

Ubuntu :

Unix Thread

, .

+4

Source: https://habr.com/ru/post/1693263/


All Articles