9

I was installing Docker Engine on Ubuntu 22.04 using the following link https://docs.docker.com/engine/install/ubuntu/, everything was okay until I reach sudo apt-get update, it gives me the following error:

E: Conflicting values set for option Signed-By regarding source https://download.docker.com/linux/ubuntu/ jammy: /etc/apt/keyrings/docker.gpg != E: The list of sources could not be read. 

I had to edit the permission for this file:

$ sudo chmod a+r /etc/apt/keyrings/docker.gpg $ cd /etc/apt/keyrings $ ls -la drwxr-xr-x 2 root root 4096 Jan 16 23:43 . drwxr-xr-x 8 root root 4096 Jan 17 00:33 .. -rw-r--r-- 1 root root 2760 Jan 16 23:43 docker.gpg 

But the error is still found, what should I do?

I attempted to delete the keyrings directory,

sudo rm -r ./keyrings 

and the sudo apt update error is still found:

sudo apt update E: Conflicting values set for option Signed-By regarding source https://download.docker.com/linux/ubuntu/ jammy: /etc/apt/keyrings/docker.gpg != E: The list of sources could not be read. 

the output of ls -l /etc/apt/sources.list.d

total 36 -rw-r--r-- 1 root root 96 Dec 10 21:30 archive_uri-http_dl_openfoam_org_ubuntu-jammy.list -rw-r--r-- 1 root root 96 Dec 10 19:29 archive_uri-http_dl_openfoam_org_ubuntu-jammy.list.save -rw-r--r-- 1 root root 72 Dec 10 21:30 download_docker_com_linux_ubuntu.list -rw-r--r-- 1 root root 72 Dec 10 19:29 download_docker_com_linux_ubuntu.list.save -rw-r--r-- 1 root root 70 Dec 10 21:30 gazebo-stable.list -rw-r--r-- 1 root root 70 Dec 10 19:29 gazebo-stable.list.save -rw-r--r-- 1 root root 0 Dec 15 23:43 official-source-repositories.list -rw-r--r-- 1 root root 248 Dec 10 19:29 official-source-repositories.list.save -rw-r--r-- 1 root root 118 Dec 10 21:31 ros2.list -rw-r--r-- 1 root root 118 Dec 10 19:29 ros2.list.save 
14
  • AFAIK Ubuntu as well as other distributions provide a (custom) docker package in their repositories. So you could simply use: 1) sudo apt update (if it's necessary 2) sudo apt upgrade (if it's necessary) 3) sudo apt install docker. Or do you have/want to install the docker package provided by Docker Community (docker-ce)? Commented Jan 17, 2023 at 1:29
  • @EdgarMagallon No, it's not necessary; all I want right now is to fix this mistake. After that, I'll see if sudo apt install docker works. :/ Commented Jan 17, 2023 at 11:48
  • Try removing the files: sudo rm /etc/apt/keyrings/docker.gpg /etc/apt/sources.list.d/docker.list. and after that run sudo apt update and sudo apt install docker Commented Jan 17, 2023 at 15:39
  • 1
    @EdgarMagallon i really appreciate your help while solving this problem, and of course you may post it and i'll mark it as solved :) Commented Jan 19, 2023 at 16:08
  • 1
    Oh ok! I'll do it! Btw, you can try podman to work with containers (generally docker and podman use the same commands). Hopefully someone provides a solution to avoid this error and can be installed docker successfully. (Or If I've found a solution I'll provide it too) Commented Jan 19, 2023 at 20:54

2 Answers 2

13

Important: This answer does not solve how to install docker. Instead it does solve how to avoid the errors given by the command: sudo apt-get update when the docker repositories were added:

E: Conflicting values set for option Signed-By regarding source https://download.docker.com/linux/ubuntu/ jammy: /etc/apt/keyrings/docker.gpg != E: The list of sources could not be read. 

Solution

You will have to remove the following files:

sudo rm /etc/apt/keyrings/docker.gpg sudo rm /etc/apt/sources.list.d/docker.list 

And if someone keeps getting the same error then it should be removed the following files:

cd /etc/apt/sources.list.d sudo rm download_docker_com_linux_ubuntu.list download_docker_com_linux_ubuntu.list.save 
2
  • 1
    This worked for me, but, do you know why it happened? Commented Jan 10, 2024 at 7:03
  • @cherouvim I'm not really sure how signs work in apt/deb packages. Maybe there is/was a bug from docker repositories that makes this happens or maybe there are conflicting values betweem the docker repository and the ubuntu reposotories. For example, in this answer the user mentioned that the file had two same entries. Commented Jan 12, 2024 at 4:40
3

I had the same

E:Conflicting values set for option Signed-By regarding source https://download.docker.com/linux/ubuntu/ jammy: /etc/apt/keyrings/docker.asc != /etc/apt/trusted.gpg.d/docker.asc, E:The list of sources could not be read.

Turned out the file

admin:///etc/apt/sources.list.d/download_docker_com_linux_ubuntu.list

had a double entry:

deb https://download.docker.com/linux/ubuntu focal stable

deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu jammy stable

deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/docker.asc] https://download.docker.com/linux/ubuntu jammy stable

commenting out the 2nd line by prefixing it with '#' (because it's double) fixed it for me. After that

sudo apt-get update

worked again

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.