Docker Repository Does Not Have a Release File on Running apt-get update on Ubuntu

156,470

Solution 1

On Linux Mint, the official instructions did not work for me. I had to go into /etc/apt/sources.list.d/additional-repositories.list and change serena to xenial to reflect my Ubuntu codename. Depending on your Debian variant, version, and the original installation method followed, you may need to modify /etc/apt/sources.list.d/docker.list instead.

You can typically find the appropriate codename by running one of a few different commands. In the following examples, focal is the codename:

$ grep CODENAME /etc/os-release
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

$ lsb_release -c
Codename:   focal

# NOTE: On Ubuntu 20.04.2, /etc/os-release is symlinked to /usr/lib/os-release and
#       lsb_release reads from /usr/lib/os-release.

Solution 2

For Linux Mint, this problem is actually referenced in the Docker website:

Note: The lsb_release -cs sub-command below returns the name of your Ubuntu distribution, such as xenial. Sometimes, in a distribution like Linux Mint, you might have to change $(lsb_release -cs) to your parent Ubuntu distribution. For example, if you are using Linux Mint Rafaela, you could use trusty.

amd64:

$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

The lsb_release -cs command gives a repository for which Docker has no prepared package - you must change it to xenial.

The correct command for Linux Mint 18 which is based on Ubuntu 16.04 Xenial is

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   xenial \
   stable"

Solution 3

Elliot Beach is correct. Thanks Elliot.

Here is the code from my gist.

sudo apt-get remove docker docker-engine docker.io

sudo apt-get update

sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
xenial \
stable"

sudo apt-get update

sudo apt-get install docker-ce

sudo docker run hello-world

Solution 4

As suggested in official docker document also. Try running this:

  • sudo vi /etc/apt/sources.list

Then remove/comment any (deb [arch=amd64] https://download.docker.com/linux/ubuntu/ xenial stable) such entry at the last lines of the file.

Then in terminal run this command:

  • sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu/ bionic stable"

  • sudo apt-get update

It worked in my case.

Solution 5

Linux Mint 20 Ulyana users need to change "ulyana" to "bionic" in

/etc/apt/sources.list.d/additional-repositories.list

like so:

deb [arch=amd64] https://download.docker.com/linux/ubuntu    bionic    stable
Share:
156,470
Daniel Eagle
Author by

Daniel Eagle

I am a Cloud Architect, Software Engineer, DevOps/QA Influencer, and educator. I enjoy caffeine and sharing knowledge.

Updated on September 21, 2021

Comments

  • Daniel Eagle
    Daniel Eagle over 2 years

    I am using Ubuntu 16.10 and recently installed Docker (v1.12.4) using the Xenial build by following the instructions found here. I haven't encountered any problems creating containers, ensuring they restart automatically, etc.

    However, now every time I run apt-get update I receive the following error message:

    W: The repository 'https://apt.dockerproject.org/repo ubuntu-xenial Release' does not have a Release file.
    N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: Failed to fetch https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/Packages
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    

    I have tried to remedy the problem by following the advice found here and cannot seem to solve this problem.

    Has anyone encountered this before and fixed it? If so, what is needed to resolve this?

  • lobati
    lobati about 6 years
    Just a note, for some reason there was a docker line with trusty and another with serena in that file for me. Maybe I tried to go through this same process some time back and forgot about it. At any rate, I had to delete the trusty line, otherwise it complained about unresolvable dependencies.
  • Marinos An
    Marinos An almost 6 years
    The command you have provided is the same as the one that exists on the docker site. However it does not work for me on ubuntu 16.04. The entry generated in sources.list is: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable But still the same problem. I wish someone could explain why it cannot find Release inside https://download.docker.com/linux/ubuntu/dists/xenial/stable‌​/binary-amd64/. Sad: After so many years of using ubuntu I still can't figure out how things work with repository paths.
  • rainabba
    rainabba over 5 years
    This solved my issues getting things moving on the new WLinux distro also.
  • spuder
    spuder over 5 years
    Careful running these commands if not running xenial. This command would be safer add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  • Sergei G
    Sergei G over 5 years
    On Ubuntu 18.10 I commented out this line: # deb [arch=amd64] download.docker.com/linux/ubuntu cosmic stable
  • Strixy
    Strixy over 5 years
    In some cases (ie. Mint) the lsb_release -cs returns tara which doesn't have a supported release so specifically overriding to xenial as shown (or trusty) is a useful workaround.
  • Elliott Beach
    Elliott Beach about 5 years
    The user formally known as Elliott Beach will moving forward be referred to as Warlike Chimpanzee
  • Andrew
    Andrew almost 5 years
    Thanks for directory sources.list.d reference. Fixed Ubuntu xenial issue with "sudo rm /etc/apt/sources.list.d/docker*" . Now apt-get update works finally.
  • peschanko
    peschanko over 4 years
    The same for Debian: replace "debian 10 stable" to "debian stretch stable" in file "/etc/apt/sources.list.d/docker.list" and it should work.
  • Leamsi
    Leamsi over 4 years
    Your gist fixes the "E: Package 'containerd.io' has no installation candidate" issue with Kubuntu eoan. Some people solved it with bionic, but it didn't work for me, following your gist with xenial did. The problem arises when you use $(lsb_release -cs) because it's not fully supported. Others report using such a "misconfiguration" hack without any issues for 4 months and counting (stackoverflow.com/questions/60274857/…)
  • jpthesolver2
    jpthesolver2 almost 4 years
    I had to change mine to bionic
  • Marcelo Fonseca
    Marcelo Fonseca over 3 years
    Linux Mint 20 Ulyana is built on top of the latest Ubuntu 20.04 LTS Focal Fossa. Use focal insted
  • Youans
    Youans over 3 years
    This worked, But I had to add m to the link it was not working deb [arch=amd64] https://download.docker.co/linux/ubuntu bionic stable Notice there is a missing m in the docker.co it should be /docker.com/...
  • Clockwork
    Clockwork over 2 years
    This is the only solution that worked for me. I tried the other ones suggesting to take the Ubuntu "focal" version but I still had the same error. Taking the debian_version (bullseye), it worked.
  • Clockwork
    Clockwork over 2 years
    @MarceloFonseca I'm on the latest Linux Mint version. For some strange reasons, when I tried to use focal, it kept telling me that it doesn't have a release file. It worked only when I retrieved the Debian version in /etc/debian_version.
  • Mwesigye John Bosco
    Mwesigye John Bosco over 2 years
    changing from ulyana to bionic worked. Thanks