Linux - Docker Not Installed or Running Error

This article provides troubleshooting steps for resolving the "Docker Not Installed or Running" error on a Linux system. The issue may arise when Docker is either not installed or the user has not been added to the Docker group, preventing access to Docker commands and functionalities.


1️⃣ Verify if Docker is Installed

First, verify whether Docker is installed on your system. If Docker is installed, but you're experiencing issues, the user may not be part of the Docker group. This can cause permission issues when trying to run Docker commands. To check if Docker is installed, run the following command in the terminal: docker info


Sample Output:

Client:
 Context: default
 Debug mode: false
 Servers:
  default:
    Host: localhost
    Engine:
      Version: 20.10.14
      API version: 1.44
      Go version: go1.17.15
      Git commit: 8668127
      Built: Thu Apr 1 06:02:55 2021
      OS/Arch: linux/amd64
      Experimental: false
    Kernel: 5.15.0-52-generic
    Operating System: Ubuntu 22.04.1 LTS
    Total Memory: 31.8GiB
    CPUs: 8
  • If you see this output with Docker-related details, it indicates that Docker is installedbut the user may not be added to the Docker group . However, if the command returns an error, Docker is either not installed or not running. In such cases, you'll need to install Docker first.
If Docker is not installed on your system, follow the official installation guide for your specific Linux distribution. The installation process may vary between distributions, so ensure you're using the correct commands for your operating system.


2️⃣ Check if the User is in the Docker Group

If Docker is installed, the next step is to check whether your user account has been added to the Docker group. The Docker group allows users to execute Docker commands without needing root privileges.

  • To check if your username is part of the Docker group, run the following command:
grep -i docker /etc/group
  • Sample Output:
docker:x:999:root,$USER1,$USER2,etc
  • your username appears in this output (e.g., $USER1, $USER2), you're part of the Docker group. If your username is not listed, you'll need to add it to the Docker group.


3️⃣ Add user to Docker group

  • To add your user to the Docker group, execute the following command:

sudo usermod -aG docker $USER
  • Example:
sudo usermod -aG docker michael
  • This command appends your username to the Docker group, granting you the necessary permissions to run Docker commands without root access.


4️⃣ Verify the user

  • Docker group, you should verify that the change has been applied. To do this, re-run the command to check the groups:
grep -i docker /etc/group
  • Sample Output:
docker:x:999:root,michael
  • This output should now include your username (in this example, "michael"). If your username is not listed, you may need to repeat the previous step or ensure that the usermod command was executed properly.

5️⃣ Reboot

  • After adding the user to the Docker group, you need to reboot the system for the changes to take effect. Use the following command to reboot the server:

sudo reboot
  • Note: Rebooting ensures that any session-related changes are applied, and the system properly recognizes the group membership for the user.

6️⃣ Restart Services

  • After rebooting, it is a good practice to restart the Docker service to ensure it is functioning correctly.

  • To restart Docker, use the following command:
sudo systemctl restart docker

Once Docker has restarted, run the docker info command again to verify that Docker is running smoothly.


If you're still facing issues after adding your user to the Docker group, and after restarting the server and Docker service, it may indicate a deeper configuration or system problem. In such cases, you may want to consider reinstalling Docker. This can help resolve issues with Docker installations that may have become corrupted or misconfigured.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article