getting error while installing docker: "docker-ce : Depends: containerd.io (>= 1.2.2-3) but it is not going to be installed "
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?
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
sudo snap install docker
Ubuntu 18.04 this worked for me.
Following links did not work
- https://docs.docker.com/install/linux/docker-ce/ubuntu/
- https://phoenixnap.com/kb/how-to-install-docker-on-ubuntu-18-04
- https://containerd.io/downloads/
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
.