Remove Docker's PPA repository

I’m using WSL so using the PPA Gui isn’t a possibility. I added the Docker PPA with this command:

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

And I’m able to see it with this command:

$ apt policy

relevant lines:

500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     release o=Docker,a=bionic,l=Docker CE,c=stable,b=amd64
     origin download.docker.com

But how can I remove this repository without GUI access? I’ve tried various permutations of:

sudo apt-add-repository --remove ppa:ABC/DEF

with no success

Asked By: philshem

||

One option is to manually remove entries from this file, with sudo/root:

/etc/apt/sources.list
Answered By: philshem

Open a terminal and type

sudo add-apt-repository --remove NAME_OF_PPA

If you need to search your software sources lists to see what PPA’s you currently have active:

grep -r -i ppa /etc/apt/

Next, you can open any link starting with “http://ppa.launchpad.net” and find the exact PPA name you need.

Refresh the package manager’s information:

sudo apt update

Finally, remove the package and its dependencies with:

sudo apt autoremove NAME_OF_PACKAGE

After you enter this command, pay close attention to the list of packages that will be removed. If you see something you need in that list, then use the remove option of apt (instead of autoremove):

sudo apt remove NAME_OF_PACKAGE
Answered By: 24601

@philshem If you want to remove entries manually, you have to keep in mind that /etc/apt/sources.list isn’t necessarily the only file containing entries. There might be some files in /ets/apt/sources.list.d/ you’d want to inspect and remove as needed.

Answered By: BOstendorf