Skip to main content
When you have multiple APT repositories configured for the same software, it’s important to know which one is being used — especially after adding a new repository while the system still uses an older one.
1
Check the pinned priority
2
APT uses the repository with the highest priority. Check priorities with:
3
apt-cache policy
4
To check the priority for a specific package (e.g., docker-ce):
5
apt-cache policy docker-ce
6
Sample output:
7
docker-ce:
  Installed: (none)
  Candidate: 5:20.10.24~3-0~ubuntu-jammy
  Version table:
     5:20.10.24~3-0~ubuntu-jammy 500
        500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
     5:20.10.24~3-0~ubuntu-focal 500
        500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
8
The Candidate version indicates which repository is being used.
9
Inspect the installed package source
10
If the package is already installed, check which repository it came from:
11
apt-cache policy docker-ce
12
Manually manage repository files
13
If you want to ensure only one repository is used, comment out or remove the unwanted entry:
14
sudo nano /etc/apt/sources.list.d/download_docker_com_linux_ubuntu.list
15
Comment out the unwanted line:
16
# deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable
deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable
17
Then update the package cache:
18
sudo apt update
19
Verify the repository again
20
After making changes, confirm the correct repository is being used:
21
apt-cache policy docker-ce

Build docs developers (and LLMs) love