15

I am trying to install Docker on my Ubuntu 18.04, but I am getting this error:

The following packages have unmet dependencies:
  docker-ce : Depends: containerd.io (>= 1.2.2-3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

What do I do to fix it?

2
8

You have to install containerd package, this is how I solved it.

$ curl -O https://download.docker.com/linux/ubuntu/dists/bionic/pool/edge/amd64/containerd.io_1.2.2-3_amd64.deb

$ sudo apt install ./containerd.io_1.2.2-3_amd64.deb 
3
  • i actually upgraded from ubuntu 18.04 to ubuntu 19.04, and this problem has been solved automatically btw Thanks – vatsalay Jan 17 '20 at 16:50
  • 1
    Thanks! This worked for me on Ubuntu 16.04 – Canella Feb 6 '20 at 14:11
  • Yes, this should work. For some weird reason, the package containerd.io is missing in the docker repository and you need to install it manually. Another and perhaps simpler solution is to directly use the Ubuntu package docker.io to install docker -- all dependencies will be met. For more details see my answer askubuntu.com/a/1212388/456438 – Dominic108 Feb 23 '20 at 17:37
4
sudo snap install docker

Ubuntu 18.04 this worked for me.

Following links did not work

  1. https://docs.docker.com/install/linux/docker-ce/ubuntu/
  2. https://phoenixnap.com/kb/how-to-install-docker-on-ubuntu-18-04
  3. https://containerd.io/downloads/
2
1

In Ubuntu 19.10, you can install docker by installing the package docker.io, which has containerd and runc as dependencies. Alternatively, you can install docker-ce, docker-ce-cli directly from the docker repository as explained here https://docs.docker.com/install/linux/docker-ce/ubuntu/. In this alternative approach, the dependencies containerd and runc are replaced by a single dependency containerd.io. The problem is that, for some weird reason, containerd.io is not in the docker repository. So you need to install it manually as suggested in https://askubuntu.com/a/1190896/456438.

Note that containerd.io is said (in the package itself) to be a valid replacement for containerd and runc. The converse is not affirmed, but if you modify the packages docker-ce and replace the dependency for containerd.io with containerd, it works: I followed intructions in https://fabianlee.org/2018/09/28/ubuntu-customizing-and-repacking-a-deb-file/ to change the dependency in the package (without sudo):

cd $(mktemp -d -t docker-XXX)
apt download docker-ce 
ar xf docker-ce_*.deb
mkdir DEBIAN
tar xf control.tar.xz -C DEBIAN

The first command only creates a temporary directory and cd to it. The remainder extracts 5 files from the package in the DEBIAN subdirectory. I edited the file DEBIAN/control to change containerd.io to containerd and saved the file. I continued with the instructions to reconstruct the package:

tar -C DEBIAN -cJf control.tar.xz .
ar rcs docker-ce.deb debian-binary control.tar.xz data.tar.xz

This creates a new deb file docker-ce.deb in the temporary directory. I followed the instruction here https://docs.docker.com/install/linux/docker-ce/ubuntu/ but in sudo apt install ... commands I replaced containerd.io with containerd and docker-ce with ./docker-ce.deb. It worked ! Tested with docker run hello-world.

1

I assume you already fixed this. But for those who may have the same issue later, you can follow the simple instructions here https://docs.docker.com/engine/install/ubuntu/ Specifically, "Install from Repository".

  1. Set up the repository

    Update the apt package index and install packages to allow apt to use a repository over HTTPS:

     sudo apt-get update
     sudo apt-get install \
      apt-transport-https \
      ca-certificates \
      curl \
      gnupg-agent \
      software-properties-common
    
  2. Add Docker’s official GPG key:

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

    Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.

    $ 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) > <docker@docker.com>
    sub   rsa4096 2017-02-22 [S]
    
  3. Use the following command to set up the stable repository.

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

You will most likely install docker without any issues. It helped me on Ubuntu 19.

1
  • didn't work for me under 20.04 => getting an exec error during postInstall – malko Jan 19 at 10:20
0

Is there an issue opened in github for this https://github.com/docker/for-linux/issues/832 and some workarounds there. There is no stable packages for Eoan yet. Some workarounds are:

  • Manually install containerd from Ubuntu bionic (and upgrade manually when needed)
  • Use bionic repository instead
  • Use test or nightly repository instead stable.

There is a available version in snap but is too old,(18.x), and there is the docker.io package in universe repositories (19.03, not last, but newer than snap).

0

Edit /etc/apt/sources.list

On this line:

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

Change eoan to bionic

Run sudo apt update, then retry installing docker-ce

1
  • not sure why this was downvoted by someone, it's a perfectly valid approach. – Ahmed Masud Feb 28 '20 at 14:38
0

https://github.com/ratulb/k8s-easy-install/blob/docker/install-docker.sh - This would take care of adding right repositories. Verified for debian 10, ubuntu 16.04/18.04/20.04.

4
  • 1
    Are you associated with that Git repository? – Kulfy Jan 19 at 14:35
  • Yes - that's mine. – R Buragohain Jan 20 at 11:09
  • Since you are affiliated, you must disclose that affiliation in the post. If you don't disclose affiliation, it's considered spam. See: What signifies "Good" self promotion?, some tips and advice about self-promotion, and What makes something spam. – Kulfy Jan 22 at 7:57
  • Apart from that, there are many things to be fixed in your script. For example, cat abuse, unnecessary usage of sudo for reading /etc/*release, usage of Eoan Ermine (19.10) repository for 20.04 and 20.10, given that release files for latter ones exist and 19.10 reached its end of life in July 2020, etc. – Kulfy Jan 22 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.