Docker command not found - Ubuntu
How to Install Docker on Ubuntu
If you are encountering the “Docker command not found” error on your Ubuntu system, it means that Docker is not installed or not properly configured. Docker is a popular platform for developing, shipping, and running applications in containers.
To install Docker on Ubuntu, follow these steps:
Step 1: Update Package Index
Before installing Docker, it’s a good practice to update the package index on your system to ensure you are installing the latest version.
sudo apt update
Step 2: Install Dependencies
To allow apt to use a repository over HTTPS, install the necessary packages:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Step 3: Add Docker’s Official GPG Key
Add Docker’s official GPG key to ensure the authenticity of the software packages:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Step 4: Set Up Docker Repository
Add the Docker repository to your system’s sources list:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Step 5: Install Docker
Update the package index again and install Docker:
sudo apt update
sudo apt install docker-ce
Step 6: Start and Enable Docker Service
Start the Docker service and enable it to start on system boot:
sudo systemctl start docker
sudo systemctl enable docker
Step 7: Verify Docker Installation
Check if Docker has been successfully installed by running the following command:
docker --version
If you see the Docker version information, it means Docker has been installed correctly on your Ubuntu system.
Solution for “Docker command not found” Error
If any of the commands above are not compatible with your Ubuntu system, you can try the following alternative approach:
-
Docker Installation Script: Use the official Docker installation script provided by Docker to install Docker on Ubuntu. You can find the script and instructions on the Docker website.
-
Docker Snap Package: Install Docker as a snap package by running the following command:
sudo snap install docker
By following these steps, you should be able to successfully install Docker on your Ubuntu system and resolve the “Docker command not found” error. Docker is a powerful tool that simplifies the process of managing and deploying applications within containers, offering a more efficient and scalable development environment.