How To Install Docker On Ubuntu 24.04 LTS
Docker is an amazing platform that helps to simplify the application development and deployment using containers that is a self-contained packages that bundle your application’s code along with all the libraries and other required files that it needs to execute . This is one of the revolutionary ideas of creating a software and deploying it in a portable manner. With the help of it, You can easilyt build, test, and deploy applications as portable containers that can run from anywhere of the world. It can be from local machines or it can be the cloud-based servers. Docker is available for installation from the standard Ubuntu repositories but it might not be the latest version of the Docker.
How To Install Docker On Ubuntu 24.04 LTS
Run the following commands at first to update the packages and install the dependencies.
sudo apt update sudo apt install ca-certificates curl gnupg
Now, run the following commands to import the Docker repository’s GPG key to your Ubuntu 24.04 LTS:
sudo mkdir -p /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
Now add the Docker APT repository to your system:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu (lsb_release -cs) stable" | \ sudo tee /etc/apt/sources.list.d/docker.list
Now that the Docker repository is enabled, you can easily install any Docker version that is available in the repositories.
Install Latest Version Of Docker On Ubuntu.
Run the following commands to install the latest version of Docker.
sudo apt update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Run the following commands to install the skip version of Docker on Ubuntu.
If you want to install a specific version, first list out the available versions in the Docker repository with the following commands:
sudo apt update apt list -a docker-ce
Install a specific version by adding = after the package name.
For example to install version “5:25.0.1-1~ubuntu.22.04~jammy ” , you need to type the following:
DOCKER_VERSION=5:25.0.1-1~ubuntu.22.04~jammy sudo apt-get install docker-ce=$DOCKER_VERSION docker-ce-cli=$DOCKER_VERSION containerd.io docker-buildx-plugin docker-compose-plugin
Once the installation is completed, run the following command to verify:
sudo systemctl status docker
How To Uninstall Docker From Ubuntu 24.04 LTS
At first, you need to stop all running containers and remove all docker objects. Run the following commands for it:
docker container stop $(docker container ls -aq) docker system prune -a --volumes
You can now uninstall Docker with the following commands:
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras sudo apt autoremove
You can also delete the directories that were created during the Docker installation. The following command will completely remove Docker from your system,
sudo rm -rf /var/lib/{docker,containerd}
Conclusion
We’ve shown you the complete step by step process to install Docker on Ubuntu 24.04 LTS.