Unable to locate package `docker-ce` on a 64bit ubuntu

  • I'm trying to install Docker on a Ubuntu 64 machine following the official installation guide.

    Sadly Ubuntu seems it is not able to locate the docker-ce package. Any idea to fix it or at least to track what is happening ?

    Here some details for you...

    $ uname --all; sudo grep docker /etc/apt/sources.list; sudo apt-get install docker-ce
    
    Linux ubuntu 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
    
    deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable.
    # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable.
    
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package docker-ce
    

    Did you run `apt-get update` after adding the repo?

    @jordanm yes, sorry I didn't post it in the question.

  • GAD3R

    GAD3R Correct answer

    4 years ago

    Ubuntu 20.04 (Focal)

    sudo apt install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
    

    Ubuntu 19.10 (Eoan)

    sudo apt install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu eoan stable"
    

    Ubuntu 19.04 (Disco)

    sudo apt install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu disco stable"
    

    Ubuntu 18.10 (Cosmic)

    sudo apt install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic test"
    

    Ubuntu 18.04 (bionic)

    sudo apt install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
    

    Ubuntu 17.10

    docker-ce package is available on the official docker (Ubutu Artful) repository , to install it use the following commands :

    sudo apt install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable"
    

    Ubuntu 16.04

    You can install docker-ce on Ubuntu as follows:

    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 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
    

    Run the following:

    sudo apt update
    apt-cache search docker-ce
    

    sample output:

    docker-ce - Docker: the open-source application container engine
    

    Install docker-ce:

    For Ubuntu 16.04 you need to run sudo apt update. For Ubuntu 18.04 and higher, add-apt-repository will execute apt update automatically:

    sudo apt install docker-ce
    

    Docker , OS requirements

    Thx, fixed my problem. Can you please update your answer ? You mispelled the `apt-cache` command. I tried by myself but as you probably know edits should be at least 6 chars and here is just one!

    You don't need `sudo` for `apt-cache`.

    why is it not in the official repositories?

    It's worth mentioning that for Ubuntu 17.10, the step 3 would be: `sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable"`

    still not in artful repository :(

    docker not being in zesty -- but why not snap? isn't the point of snap to install packages like this?

    @GAD3R that's a good answer. perhaps bull-headed of me, want to install with snap -- if do-able. (I mean, it installs, but then...etc. something about apparmor.) I'll come back and try this at some point -- I'm sure it works :)

    @MichaelWiles please see my answer for Ubuntu 17.10 (artful): https://unix.stackexchange.com/a/406952/102003

    Following the procedure above for 16.04 LTS still results in "Package docker-ce is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source"

    The instructions for 17.10 also worked for me in 18.04, when the official `docker-ce` install instructions did not. Maybe not recommended though, since it's from the `artful` repo?

    Indeed for 18.04 bionic docker repo from test fixed the issue sudo apt-get install docker-ce Reading package lists... Done Building dependency tree Reading state information... Done Package docker-ce is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'docker-ce' has no installation candidate Fix: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ test" sudo apt-get update Install docker

    I would recommend putting your updated answers on top and not at the bottom. I ran the outdated answer before seeing the updated answer.

    For ubuntu 19.04 I found @pwaterz comment useful, which only `sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" ` worked. Note **bionic**

    For Ubuntu 18.04 (Bionic), I had to do: `sudo apt install docker-containerd docker-doc docker-runc docker.io` (still having problems running hello-world, but...)

    @Andrew Welcome, It is better to ask a new question, please clarify the problem (command used to install/run docker , error messages) to get an answer.

    @GAD3R It wasn't a question.

    @GAD3R +1 Thanks for the exhaustive list steps. For Ubuntu 16.04, I had to do `sudo apt update` before running the final `sudo apt install docker-ce`. This step is also listed here: https://www.linode.com/docs/applications/containers/install-docker-ce-ubuntu-1804/ Else I was getting the same/original error as @tim11g pasted.

    @rahuljain1311 Thank you, I have updated my answer.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM