Jobin Jose
Jobin Jose

Reputation: 37

Error showing while trying to install Docker CE on Linux Ubuntu 18.04 Bionic?

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following NEW packages will be installed:

docker-ce

0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Need to get 0 B/33,8 MB of archives.

After this operation, 181 MB of additional disk space will be used. (

Reading database ... 129600 files and directories currently installed.)
Preparing to unpack .../docker-ce_18.03.1~ce-0~ubuntu_amd64.deb ...
Unpacking docker-ce (18.03.1~ce-0~ubuntu) ...

dpkg: error processing archive /var/cache/apt/archives/docker-ce_18.03.1~ce-0~ubuntu_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/docker-containerd', which is also in package docker-containerd 0.2.3+git+docker1.13.1~ds1-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/docker-ce_18.03.1~ce-0~ubuntu_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Upvotes: 2

Views: 7946

Answers (3)

tsveti_iko
tsveti_iko

Reputation: 8012

I got this error when trying to install the latest Docker (v20.10.17) on Ubuntu Focal 20.04 (LTS) following the official documentation. I tried installing older versions and got the same error. When running sudo dockerd --debug it showed the real error:

failed to start daemon: Devices cgroup isn't mounted

Cgroupfs (Control Groups) are a kernel mechanism for tracking and imposing limits on resource usage on groups of tasks. So the solution is to mount it. Note that you need to stop the container daemon before mounting the cgroup and then start it again after that.

  1. Stop daemon

    sudo systemctl stop containerd
    
  2. Unmount (just in case) and then mount the cgroup

    sudo cgroupfs-umount 
    sudo cgroupfs-mount
    
  3. Start the daemon again

    sudo systemctl start containerd
    sudo systemctl start docker.service
    sudo systemctl start docker.socket
    
  4. If there are errors still, re-install everything

    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
    
  5. Test that Docker works

    sudo docker run hello-world
    

Upvotes: 4

Beginer
Beginer

Reputation: 375

Step 01 - Uninstall old version of Docker

$ sudo apt-get remove docker docker-engine docker.io containerd runc
$ sudo rm -rf /var/lib/docker
$ sudo apt-get autoclean
$ sudo apt-get update

Step 02 - Install Docker-ce:

Install a few prerequisite packages which let APT use packages over HTTPS:

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

Add the GPG key for the official Docker repository to system:

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

Add the Docker repository to APT source:

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

Update the package database

$ sudo apt update

Make sure you are about to install from the Docker repo instead of the default Ubuntu repo

$ apt-cache policy docker-ce

Finally, install Docker:

$ sudo apt install docker-ce

Verify docker is running

$ sudo systemctl status docker

Upvotes: 0

BMitch
BMitch

Reputation: 264156

I don't see 18.04 listed on the supported list so you may be encountering compatibility issues that the developers have not had time to resolve. To work around your immediate issue, I would uninstall "docker-containerd" and any other dependent packages since that appears to be based on a very old version of docker (1.13).

apt remove docker-containerd

Upvotes: 1

Related Questions