Docker Community Forums

Share and learn in the Docker community.

Docker install fails in ubuntu server 18.04 bionic - Repositories [SOLVED]

Hello,
I was trying to install docker in my virtual machine by doing:

    $ curl -fsSL https://get.docker.com -o get-docker.sh
    $ sudo sh get-docker.sh

And I got:

    # Executing docker install script, commit: 442e66405c304fa92af8aadaa1d9b31bf4b0ad94
+ sh -c 'apt-get update -qq >/dev/null'
+ sh -c 'DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null'
+ sh -c 'curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null'
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sh -c 'echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" > /etc/apt/sources.list.d/docker.list'
+ sh -c 'apt-get update -qq >/dev/null'
+ '[' -n '' ']'
+ sh -c 'apt-get install -y -qq --no-install-recommends docker-ce >/dev/null'
E: Failed to fetch https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/containerd.io_1.2.13-1_amd64.deb  Hash Sum mismatch
   Hashes of expected file:
    - SHA512:45640591cd629a357cdf4ab3b5225dd8c4ce3f7100ab35b776502224014c76db164f849f52bf044919b01a4acbb075a11aacc514d386af398c6f93ba7ef35e2e
    - SHA256:e0f9d311a77ce0729a25f41925f6b3174616f704fd21bbc7c4d91a1012f360a8
    - SHA1:4c7a98e8145fb258c24044c78f6f1f8abc1f6893 [weak]
    - MD5Sum:7eaf2d7d924a20d6fbf1ce8cd155b67e [weak]
    - Filesize:20144902 [weak]
   Hashes of received file:
    - SHA512:6bc2123911f6a7e67b466e6b5449b47b6a14385c1b66d2a1bd1325c3d7c7cb60922fee01f44144bdb8d71ba2e09ce82d83cb231811750ca7c9c7158c3bdecadd
    - SHA256:df81a5cf9c086cbd3ce9c789e08855ae8e439d07bb0818563cf973ce323c88dd
    - SHA1:226d25d2da80b298b06e2a0d465f1ddb5c8f968e [weak]
    - MD5Sum:7fc25d456dbefd805f0f7e8b49f84b2b [weak]
    - Filesize:20144902 [weak]
   Last modification reported: Tue, 03 Mar 2020 04:23:27 +0000
E: Failed to fetch https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce-cli_19.03.8~3-0~ubuntu-bionic_amd64.deb  Hash Sum mismatch
   Hashes of expected file:
    - SHA512:f2b86f90af0233ffac36743f8a567ab3df2ab8d03196707ca9eae606b796499f2c99b34380feab11b84ec895e5c470c656e0f4fccf149eba25799910fa593ca1
    - SHA256:b3942ad3191de83eb3540f5096dc27783fff8de21227ad5f94fec194fcc3c2e7
    - SHA1:1ae24a9b73cbc7ca4a048ac204a4470df4d2bc80 [weak]
    - MD5Sum:59f94df4a18df9ad4d9e34718e210742 [weak]
    - Filesize:42556330 [weak]
   Hashes of received file:
    - SHA512:e38b7747caab0de9026aa6af53e6d12958e5928da2354241174e3ad9f7933304a4f4b243596deee273599b961a3b92d58bd7427390e981482ef8f246ad69dddd
    - SHA256:19f960dd7bd8970c1f87c6ea3341d404ec9b292e46ccf407cf9bc091bea3f93b
    - SHA1:90b9133e51d6ebdab464414a26c5a5928970323f [weak]
    - MD5Sum:f1f3ddcf7d02f98b0da2c549b22db630 [weak]
    - Filesize:42556330 [weak]
   Last modification reported: Wed, 11 Mar 2020 19:46:25 +0000
E: Failed to fetch https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce_19.03.8~3-0~ubuntu-bionic_amd64.deb  Hash Sum mismatch
   Hashes of expected file:
    - SHA512:600f2d9b51024e5866a6256f2d08b4e733a6c8428e334d81de483a7138cbe9db00e8d67673a88d46c80ef0aa673e2f0183f8fd58226575a3a6a843f955c49e2a
    - SHA256:22fe06851dde23200c835641e234760bbb60b79abc3b2a1fbbd1a9b0f1a2e9d0
    - SHA1:7292df34a82e58cab0e45af61036ec19c81eb199 [weak]
    - MD5Sum:8d62aefa851deb2f0739b4a1fd232322 [weak]
    - Filesize:22879338 [weak]
   Hashes of received file:
    - SHA512:50eb2d591ac12e8775c41a3076925d9a7c5af7a3faf612b356fb1e393c6e208209f251fa0e7f9fab2e45631e4f4aa4043de2f977fafac36db134582e66fbc26a
    - SHA256:51602d32a68ea8dc2c7a138e964aa4566fadbe0867fabd8fd747a2badef98049
    - SHA1:c2532415383e4eec5dc1e137034ebec7b2e40b82 [weak]
    - MD5Sum:cbfb597bbb6a66248b76907ee0f18ba1 [weak]
    - Filesize:22879338 [weak]
   Last modification reported: Wed, 11 Mar 2020 19:46:26 +0000
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Thank you in advance for any help you may provide or just for taking the time to read this…

I manage to solve it by doing:

sudo rm -rf /var/lib/apt/lists/*
sudo apt-get clean
sudo apt-get update --fix-missing

And then:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh