Installing Docker Engine on Ubuntu: A step-by-step guide
What is Docker Engine?
The Docker Engine is the core component of Docker, a popular platform for developing, shipping, and running applications in containers. It's a lightweight runtime and tooling that packages applications and their dependencies into standardized units called containers, which can then be easily deployed on any host system that supports Docker.
Install Docker Engine on Ubuntu:
Installing Docker on Ubuntu is straightforward. Below are step-by-step instructions for installing Docker Engine on an Ubuntu system.
1. Uninstall Old Versions
If you have any old versions of Docker, uninstall them:
sudo apt-get remove docker docker-engine docker.io containerd runc
2. Update Package Information
Update your existing list of packages:
sudo apt-get update
3. Install Required Packages
Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install -y ca-certificates curl gnupg lsb-release
4. Add Docker’s Official GPG Key
Add Docker’s official GPG key:
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
5. Set Up the Docker Repository
Add the Docker repository to your sources list:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
6. Install Docker Engine
Update the apt package index again and install Docker Engine:
sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
7. Verify Docker Installation
Check that Docker is installed and running:
sudo docker run hello-world
This command downloads a test image and runs it in a container. If Docker is installed correctly, the output will confirm that Docker is working.
Check Docker version:docker --version
This should display the Docker version installed on your system.You have now successfully installed Docker Engine on your Ubuntu system. Docker should be ready to use, and you can start running and managing containers.
Do you want to learn how Docker works? Here is a blog that simply shows how to use MySQL database using Docker.