Running docker build .
against the following dockerfile
FROM ubuntu:16.04
MAINTAINER [email protected]
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get update -y
I get the 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.
I then tried adding every solution in this question to my dockerfile: Trouble downloading packages list due to a "Hash sum mismatch" error
FROM ubuntu:16.04
MAINTAINER [email protected]
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
but I get the same error.
What else can I do?
The chosen solution didn't work for me. And I noticed that this isn't always the case - that is, if I wait a day or two, I don't get the error. I suspect it has more to do with the ubuntu repositories than the version of docker we use (as explained by Robie).
My solution is to use one of the official mirrors instead of the default ubuntu repo. Replace xenial with your ubuntu version. You might need an extra deb-src line for all or none of the lines depending on where you are getting the mismatch. I noticed that the mirrors are slower compared to the default.
I think I might have figured your problem:
You might have missing dependencies for Docker, or docker is not installed correctly.
Here is the full instruction for the Docker installation on Ubuntu.
Especially this part might be missing.
I would advise you to reinstall docker with these official instructions.
If the problem should persist, there might be a problem with the network connection of your VM or your host machine.
After all your Dockerfile seems correct to me, so this shouldn't be the cause.