For linux, download from http://docs.docker.com/engine/installation/linux/. For Ubuntu, read and follow the step here.
- Check the kernel machine. The kernel should be newer than 3.1. Also docker requires 64-bit Ubuntu.
12teddy@teddy-K43SJ:~$ uname -r4.4.0-38-generic
My kernel version is 4.4.0-38 (PASS) - Update APT source
Update system
1sudo apt-get update
Update package information, ensure that APT works with the https method, and that CA certificates are installed.
1234567teddy@teddy-K43SJ:~$ sudo apt-get install apt-transport-https ca-certificatesReading package lists... DoneBuilding dependency treeReading state information... Doneapt-transport-https is already the newest version.ca-certificates is already the newest version.ca-certificates set to manually installed.
Add the new GPG key
1234567teddy@teddy-K43SJ:~$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609DExecuting: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.WSnymkJUMh --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/alexmurray-indicator-sensors-daily.gpg --keyring /etc/apt/trusted.gpg.d/bhdouglass-indicator-remindor.gpg --keyring /etc/apt/trusted.gpg.d/damien-moore-codeblocks-stable.gpg --keyring /etc/apt/trusted.gpg.d/danielrichter2007-grub-customizer.gpg --keyring /etc/apt/trusted.gpg.d/font-manager-staging.gpg --keyring /etc/apt/trusted.gpg.d/geany-dev-ppa.gpg --keyring /etc/apt/trusted.gpg.d/george-edison55-nitroshare.gpg --keyring /etc/apt/trusted.gpg.d/jfi-psensor-unstable.gpg --keyring /etc/apt/trusted.gpg.d/kirillshkrogalev-ffmpeg-next.gpg --keyring /etc/apt/trusted.gpg.d/linrunner-tlp.gpg --keyring /etc/apt/trusted.gpg.d/maarten-baert-simplescreenrecorder.gpg --keyring /etc/apt/trusted.gpg.d/mc3man-trusty-media.gpg --keyring /etc/apt/trusted.gpg.d/n-muench-programs-ppa2.gpg --keyring /etc/apt/trusted.gpg.d/obsproject-obs-studio.gpg --keyring /etc/apt/trusted.gpg.d/ondrej-php.gpg --keyring /etc/apt/trusted.gpg.d/ondrej-php5-5_6.gpg --keyring /etc/apt/trusted.gpg.d/ondrej-php5-compat.gpg --keyring /etc/apt/trusted.gpg.d/osmoma-audio-recorder.gpg --keyring /etc/apt/trusted.gpg.d/recoll-backports-recoll-1_15-on.gpg --keyring /etc/apt/trusted.gpg.d/tsvetko_tsvetkov-trusty-backports.gpg --keyring /etc/apt/trusted.gpg.d/tuxonice-ppa.gpg --keyring /etc/apt/trusted.gpg.d/ubuntu-audio-dev-alsa-daily.gpg --keyring /etc/apt/trusted.gpg.d/umang-indicator-stickynotes.gpg --keyring /etc/apt/trusted.gpg.d/webupd8team-brackets.gpg --keyring /etc/apt/trusted.gpg.d/webupd8team-java.gpg --keyring /etc/apt/trusted.gpg.d/wine-wine-builds.gpg --keyring /etc/apt/trusted.gpg.d/xorg-edgers-ppa.gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609Dgpg: requesting key 2C52609D from hkp server p80.pool.sks-keyservers.net?: p80.pool.sks-keyservers.net: Host not foundgpgkeys: HTTP fetch error 7: couldn't connect: Successgpg: no valid OpenPGP data found.gpg: Total number processed: 0
Then Open the /etc/apt/sources.list.d/docker.list file in your favorite editor. If the file doesn’t exist, create it.
1teddy@teddy-K43SJ:~$ sudo gedit /etc/apt/sources.list.d/docker.list
Make sure the file is empty or remove any existing entries. Add this on file for Ubuntu Trusty 14.04 (LTS)
1deb https://apt.dockerproject.org/repo ubuntu-trusty main
Save and close the file.
Update the system
1sudo apt-get update
Purge the old repo if it exists.
123456teddy@teddy-K43SJ:~$ sudo apt-get purge lxc-dockerReading package lists... DoneBuilding dependency treeReading state information... DonePackage 'lxc-docker' is not installed, so not removed...
Verify that APT is pulling from the right repository.
12345678910teddy@teddy-K43SJ:~$ apt-cache policy docker-enginedocker-engine:Installed: (none)Candidate: 1.12.1-0~trustyVersion table:1.12.1-0~trusty 0500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages1.12.0-0~trusty 0500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages...
CONT….
20260730
Install Docker on Ubuntu 22.04
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
satria@teddy:~$ sudo apt install docker.io -y [sudo] password for satria: Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: containerd.io : Conflicts: containerd E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. |
It looks like you’ve run into a package conflict while trying to install Docker. This is a common issue on Ubuntu and can be resolved by removing the conflicting package and then using Docker’s official installation repository, which is the recommended method.
The error containerd.io : Conflicts: containerd means that a package required by docker.io (which is containerd.io) conflicts with a version of containerd that is already on your system or available in a different repository.
Here is a step-by-step guide to fix this and get Docker installed correctly.
Step 1: Uninstall Old and Conflicting Packages
First, let’s remove the conflicting containerd package and any other old Docker-related packages to ensure a clean slate.
|
1 2 |
<span class="token">sudo</span> <span class="token">apt-get</span> remove <span class="token">docker</span> docker-engine docker.io containerd runc |
Step 2: Set Up the Official Docker Repository
Instead of using docker.io from the default Ubuntu repository, it’s best to use the official Docker repository. This ensures you get the latest version and avoid conflicts.
- Update your package list and install prerequisites:
123<span class="token">sudo</span> <span class="token">apt-get</span> update<span class="token">sudo</span> <span class="token">apt-get</span> <span class="token">install</span> ca-certificates <span class="token">curl</span>
- Add Docker’s official GPG key:
1234<span class="token">sudo</span> <span class="token">install</span> -m 0755 -d /etc/apt/keyrings<span class="token">sudo</span> <span class="token">curl</span> -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc<span class="token">sudo</span> <span class="token">chmod</span> a+r /etc/apt/keyrings/docker.asc
- Set up the repository:
12345<span class="token">echo</span> <span class="token">\</span><span class="token">"deb [arch=</span><span class="token">$(</span><span class="token">dpkg --print-architecture</span><span class="token">)</span><span class="token"> signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \</span> <span class="token">$(</span><span class="token">.</span><span class="token"> /etc/os-release </span><span class="token">&&</span> <span class="token">echo</span> <span class="token">"</span><span class="token">$VERSION_CODENAME</span><span class="token">"</span><span class="token">)</span><span class="token"> stable"</span> <span class="token">|</span> <span class="token">\</span><span class="token">sudo</span> <span class="token">tee</span> /etc/apt/sources.list.d/docker.list <span class="token">></span> /dev/null
Step 3: Install Docker Engine
Now that the correct repository is set up, update your package list again and install the latest Docker packages.
|
1 2 3 |
<span class="token">sudo</span> <span class="token">apt-get</span> update <span class="token">sudo</span> <span class="token">apt-get</span> <span class="token">install</span> docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y |
Step 4: (Optional but Recommended) Manage Docker as a Non-Root User
To avoid having to type sudo every time you run a Docker command, add your user to the docker group.
|
1 2 3 |
<span class="token">sudo</span> <span class="token">groupadd</span> <span class="token">docker</span> <span class="token">sudo</span> <span class="token">usermod</span> -aG <span class="token">docker</span> <span class="token environment">$USER</span> |
Important: You will need to log out and log back in for this group change to take effect.
After following these steps, Docker should be installed correctly. You can verify it by running:
|
1 2 |
<span class="token">docker</span> run hello-world |
Once Docker is running, you can proceed with the SonarQube setup I outlined previously, starting with the docker run command for SonarQube. Let me know if you encounter any other issues