Check which APT repo is being used¶
To determine which APT repository is being used for a specific package, you can follow these steps:
Step 1: Check the Pinned Priority¶
APT uses the repository with the highest priority. You can check the priority of each repository using the following command:
In this example, we will be looking for the docker-ce package (or any Docker-related package) in the output. It will show the repository URL and its priority. For example:
Sample output:
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
Step 2: Inspect the installed package¶
If Docker is already installed, you can check the version and match it to the repository:
The output will show the installed version and the repository it came from.
Step 3: Manually check the repository¶
If you want to ensure only one repository is used, you can comment out or remove the unwanted entry in /etc/apt/sources.list.d/download_docker_com_linux_ubuntu.list. For example:
Comment out the line for focal if you want to use jammy:
# deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable
deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable
Then update the package cache:
Step 4: Verify the repository again¶
After making changes, verify the repository being used:
This will ensure that the correct repository (jammy in this case) is being used.