search
HomeComputer TutorialsComputer KnowledgeHow to Get Rid of the 'Cannot Connect to the Docker Daemon” Error - MiniTool

Five ways to solve the failure of Docker connection daemon

How to Get Rid of the “Cannot Connect to the Docker Daemon” Error - MiniTool

When building and running a software container with Docker, you may encounter an error message "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the Docker daemon running?" This article will provide several solutions.

Docker is an open platform for developing, publishing, and running applications, which allows you to separate applications from your infrastructure to deliver software quickly. After installing Docker, you may encounter the above error. Possible reasons include:

  • The Docker daemon is not running.
  • Docker is not cleanly closed.
  • Missing root permission to start Docker service.

Here are a few ways to fix this error:

Method 1: Use systemctl to start Docker service

If you have a new Docker installed on Ubuntu, the Docker service may not be running. systemctl command replaces the old SysV init system to manage systemd services running on Linux systems. If you do not have systemctl on your system, please install it first. This method is only for users who install Docker using the APT package manager. If you install Docker through SNAP, please refer to Method 2.

Step 1: Open the terminal.

Step 2: Execute the following commands in turn and press Enter after each command:

  • sudo systemctl unmask docker
  • systemctl start docker
  • systemctl status docker

Then, check if the "Unable to connect to Docker daemon" issue is resolved.

Method 2: Use Snap to start Docker service

If you have Docker installed using Snap package manager, you can use the snap command to manage the docker daemon.

Step 1: Open the terminal.

Step 2: Execute the following commands in turn and press Enter after each command:

  • sudo snap start docker
  • sudo snap services

Step 3: If the above command is invalid, try connecting to the docker:home plugin (it will not automatically connect by default). After the connection is complete, start the Docker service. Then, run the following command:

  • sudo snap connect docker:home :home
  • sudo snap start docker

Method 3: Clean up "Docker pull failed" and start Docker service

In some cases, you may accidentally close Docker while pulling the container. This situation will block docker.service and docker.socket files. Before starting docker, you need to unmask two unit files - docker.service and docker.daemon .

Step 1: Start the terminal and execute the following command:

  • systemctl unmask docker.service
  • systemctl unmask docker.socket
  • systemctl start docker.service

Step 2: Then, execute the following command:

  • sudo su
  • service docker stop
  • cd /var/run/docker/libcontainerd
  • rm -rf containerd/*
  • rm -f docker-containerd.pid
  • service docker start

Method 4: Start Docker for users without root permissions

You can try exporting Docker host variables to localhost via port 2375. You need to execute the command export DOCKER_HOST=tcp://localhost:2375 .

Method 5: Reinstall Docker

If the above solution is invalid, it is recommended to reinstall Docker. You can visit the official website to do it.

Summarize

The above are some common solutions to fix the Docker daemon in Docker that cannot connect to unix:///var/run/docker.sock. Is the Docker daemon running? If you have other useful ways to resolve this error, please leave a message below to let us know.

The above is the detailed content of How to Get Rid of the 'Cannot Connect to the Docker Daemon” Error - MiniTool. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Best Fixes: This Page Isn't Available Right Now on Facebook - MiniToolBest Fixes: This Page Isn't Available Right Now on Facebook - MiniToolMay 14, 2025 am 01:11 AM

This Page Isn’t Available Right Now is an error message you may encounter when you visit Facebook using your web browser. In this php.cn post, we will list some effective methods you can try to get rid of this error.

Windows 11 KB5010414 Was Released with Many New Features - MiniToolWindows 11 KB5010414 Was Released with Many New Features - MiniToolMay 14, 2025 am 01:09 AM

Windows 11 KB5010414, a new optional update for Windows 11, is available now. Do you know what’s new and fixes in it? php.cn Software will show you this information in this post. Besides, it also tells you how to download and install it on your compu

How to Change Windows Update Settings in Windows 11? - MiniToolHow to Change Windows Update Settings in Windows 11? - MiniToolMay 14, 2025 am 01:08 AM

Want to pause Windows Update on your Windows 11 computer? Want to set active hours to arrange a computer restart to complete the update process? You need to know how to change Windows Update settings in Windows 11. This php.cn post will show you the

How to Fix Wdcsam64_prewin8.sys Core Isolation Turned off - MiniToolHow to Fix Wdcsam64_prewin8.sys Core Isolation Turned off - MiniToolMay 14, 2025 am 01:06 AM

Some Windows 11 users report that they receive the “Core Isolation turned off due to wdcsam64_prewin8.sys incompatibility” error message on Windows Security. If you are one of them, you come to the right place. This post from php.cn provides solution

How to Easily Insert Images in OneNote on Windows - MiniToolHow to Easily Insert Images in OneNote on Windows - MiniToolMay 14, 2025 am 01:05 AM

You may like to use OneNote to record information, but do you know how to insert pictures or videos in OneNote on Windows? In this article on php.cn, you will get some available tips.

How to Add and Edit Signature in Outlook 365 - MiniToolHow to Add and Edit Signature in Outlook 365 - MiniToolMay 14, 2025 am 01:04 AM

This post teaches you how to add and edit signature in Outlook 365 email. For more computer tips, tricks, and useful free tools, you may visit php.cn Software official website.

How to Fix Battlefield 2042 DirectX Error? Solutions Are Here! - MiniToolHow to Fix Battlefield 2042 DirectX Error? Solutions Are Here! - MiniToolMay 14, 2025 am 01:02 AM

DXGI_ERROR_DEVICE_REMOVED or DXGI_ERROR_DEVICE_HUNG are the most common DirectX errors when playing Battlefield 2042. If you are also one of the victims of Battlefield 2042 DirectX error, you can check out this tutorial on php.cn Website for more hel

How to Download Epson Scanner Driver Software on Windows & Mac? - MiniToolHow to Download Epson Scanner Driver Software on Windows & Mac? - MiniToolMay 14, 2025 am 12:59 AM

If you need to download Epson scanner driver software on your Windows or macOS computer, do you know how to do this? The best choice is to download one from the official site of Epson. php.cn Software will show you how to perform an Epson scanner dri

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools