"Package 'docker-ce' has no installation candidate" in 18.04

219,683

Solution 1

From the same guide you referenced, you can use repository for 17.10 instead at this moment:

deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable

And all docker-ce dependent packages will be resolved from the ubuntu bionic repository. Check the Docker documentation for more info. No compatibility issues to worry about :)

2018-07-19 update

Docker 18.06 has been updated to bionic repository, this workaround is not required anymore!

Solution 2

Run this if you want to install the docker-ce on Ubuntu 18.04:

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 `lsb_release -cs` test"
sudo apt update
sudo apt install docker-ce

To check if the installation ended successfuly, just run:

docker -v

should output:

Docker version 18.06.1-ce, build e68fc7a

Solution 3

Some of the guides jumped the gun; docker-ce is not available for Ubuntu 18.04 yet at the time of this post. You can check the list of supported versions here.

That same guide you linked to suggested installing docker.io; this is what I did. It's a workaround until docker-ce supports 18.04.

Solution 4

I had the same issue, here is how I fixed it:

$ sudo snap install docker

$docker -v

Docker version 18.06.1-ce, build e68fc7a


$sudo docker version


Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.4
 Git commit:        e68fc7a
 Built:             Tue May  7 18:01:43 2019
 OS/Arch:           linux/386
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       e68fc7a
  Built:            Tue May  7 18:01:44 2019
  OS/Arch:          linux/386

Solution 5

Following the steps here in the Docker documentation worked for me. I just had to change stable to test in this command

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

Related videos on Youtube

Robin Winslow
Author by

Robin Winslow

I'm a web developer at Canonical. I have a blog about web dev, politics and other things. I'm interested in UX, client- and server-side development, code architecture and microformats. I'm not a fan of intellectual property, and I love freedom of information and open-source.

Updated on September 18, 2022

Comments

  • Robin Winslow
    Robin Winslow over 1 year

    I'm following the official Docker installation guide for docker-ce on Ubuntu.

    When I get to sudo apt install docker-ce I get E: Package 'docker-ce' has no installation candidate:

    $ sudo apt-get update
    Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
    Hit:2 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease
    Hit:3 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease
    Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
    Reading package lists... Done
    
    $ sudo apt-get install \
    >     apt-transport-https \
    >     ca-certificates \
    >     curl \
    >     software-properties-common
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    ca-certificates is already the newest version (20180409).
    curl is already the newest version (7.58.0-2ubuntu3).
    software-properties-common is already the newest version (0.96.24.32.1).
    The following NEW packages will be installed
      apt-transport-https
    0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
    Need to get 1,692 B of archives.
    After this operation, 152 kB of additional disk space will be used.
    Do you want to continue? [Y/n] 
    Get:1 http://gb.archive.ubuntu.com/ubuntu bionic/universe amd64 apt-transport-https all 1.6.1 [1,692 B]
    Fetched 1,692 B in 0s (65.4 kB/s)               
    Selecting previously unselected package apt-transport-https.
    (Reading database ... 116694 files and directories currently installed.)
    Preparing to unpack .../apt-transport-https_1.6.1_all.deb ...
    Unpacking apt-transport-https (1.6.1) ...
    Setting up apt-transport-https (1.6.1) ...
    
    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    OK
    
    $ sudo apt-key fingerprint 0EBFCD88
    pub   rsa4096 2017-02-22 [SCEA]
          9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
    uid           [ unknown] Docker Release (CE deb) <[email protected]>
    sub   rsa4096 2017-02-22 [S]
    
    $ sudo add-apt-repository \
    >    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    >    $(lsb_release -cs) \
    >    stable"
    Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
    Hit:2 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                                    
    Hit:3 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                                  
    Get:4 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]                                                       
    Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                               
    Fetched 64.4 kB in 0s (141 kB/s)
    Reading package lists... Done
    
    robin@xps:~/git/snapcraft.io$ sudo apt-get update
    Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
    Hit:2 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease                                      
    Hit:3 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                                   
    Hit:4 https://download.docker.com/linux/ubuntu bionic InRelease                                                                                        
    Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                                
    Reading package lists... Done  
    
    $ 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
    

    My first thought was that Docker haven't released a package for Bionic yet (it's very new) but when I searched for "install docker-ce ubuntu 18.04" I found a guide which seems 18.04 specific, and basically just gives exactly the same instructions - suggesting that it at least worked for the author:

    https://linuxconfig.org/how-to-install-docker-on-ubuntu-18-04-bionic-beaver

    Does anyone have any idea why this might not be working for me?

    • Admin
      Admin almost 6 years
      See also your other options: a snap from Docker Inc, or a more-recent standard Ubuntu package in docker.io: askubuntu: Docker-CE or docker.io package
    • Admin
      Admin almost 5 years
      Still have this problem in July 2019... sudo apt install docker.io worked for me
  • tan9
    tan9 about 6 years
    From the same guide, you can use repository for 17.10 instead at this moment: deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable
  • Robin Winslow
    Robin Winslow almost 6 years
    @tan9 that should be the accepted answer - could you post it as an answer?
  • Zanna
    Zanna almost 6 years
    why did you have to do that? What version are you using? Could you add the complete steps you used?
  • R J
    R J almost 6 years
    This does not work for Ubuntu 18.04, which is what the question was about.
  • R J
    R J almost 6 years
    Still does not work on 18.04. I still get E: Package 'docker-ce' has no installation candidate
  • R J
    R J almost 6 years
    I am running 18.04, and pointing the URL to artful did not help for me. The only thing that worked was installing docker.io.
  • xExplorer
    xExplorer almost 6 years
    it work absolutely fine for me
  • NZD
    NZD almost 6 years
    @RJ It does work for me on 18.04. It is now a few days later; maybe there have been a few updates to the repositories. I noticed that some of the packages were downloaded from bionic and other ones from artful.
  • mafrosis
    mafrosis almost 6 years
  • mafrosis
    mafrosis almost 6 years
  • copser
    copser almost 6 years
    I can confirm that this is working, just installed it on 18.04 ➜ ~ docker -v Docker version 18.03.1-ce, build 9ee9f40
  • Juha Untinen
    Juha Untinen over 5 years
    FYI, since June 21, it can be installed with: curl -fsSL get.docker.com | CHANNEL=stable sh
  • Teymur Mardaliyer Lennon
    Teymur Mardaliyer Lennon about 5 years
  • pkuderov
    pkuderov about 5 years
    Also, in case of Ubuntu 19, just change bionic in the 3rd line to disco
  • pkuderov
    pkuderov about 5 years
    Btw, that url plus "bionic" plus "test" is just a path to release - you can check that url and follow the path. Seems that any valid path is viable - there're another stable/nightly/etc releases for some number of versions of Ubuntu. So for any future Ubuntu version its corresponding release can be checked there.
  • andras
    andras about 5 years
    @pkuderov Docker ce is not in that repository, the deb is also available only to containerd.io. I don't know if bionic would work instead of disco in that case. It's so frustrating.
  • Yuval Pruss
    Yuval Pruss about 5 years
    @pkuderov You can edit the response accordingly
  • pkuderov
    pkuderov about 5 years
    Guys, it looks like suffixes -ce and -ee are removed since ver. 18.09.0, so there's no mistake as far as I see. Checked my installation from test build - sudo docker run hello-world works correctly. The only problem I see - 19 ver is in beta. Sorry for confusing - only 2nd week using Linux :)
  • Marc Vanhoomissen
    Marc Vanhoomissen almost 5 years
    Welcome to AU. Could you edit your answer to provide a summary of the solution you give. This way, your answer will remain valid even even the link dispappears or changes. Thank you for your efforts.
  • d.popov
    d.popov over 4 years
    That's the easiest and most elegant solution! Just run 'sudo apt install snapd' first :)
  • James Moore
    James Moore over 4 years
    Except that notice it's installing docker 18 instead of 19. It's mostly useless.
  • Ibrahim.H
    Ibrahim.H almost 4 years
    Can we replace bionic with xenial? I've just tried it on ubuntu 16.04 and it seems to work although the ouput of lsb_release -cs was xenial.
  • FantomX1
    FantomX1 over 3 years
    thanks, as in documentation, prior installing from the repo are necessary to carry out multiple steps
  • msanford
    msanford over 3 years
    Unless, of course, you're on ARM (like a Raspberry Pi) in which case you need [arch=arm64].
  • Ramesh Ponnusamy
    Ramesh Ponnusamy almost 3 years
    Thanks mate. It worked
  • Konrad Grzyb
    Konrad Grzyb over 2 years
    "The Docker Snap is no longer maintained by Docker, Inc. The last release version was 17.06.2. The future of the Docker Snap is unclear, but it won't be developed here going forward" https://github.com/docker-archive/docker-snap
  • questionto42standswithUkraine
    questionto42standswithUkraine over 2 years
    Side-note for beginners: execute each row on its own. Copying all of the code concatenates the commands and does not execute a tail of the commands.