desktop-linux icon indicating copy to clipboard operation
desktop-linux copied to clipboard

Cannot connect to the Docker daemon after installing docker desktop on Linux

Open M41doror opened this issue 2 years ago • 31 comments

Hello, I just installed Docker Desktop on my OS Fedora 35, I have been waited a while for this feature, I'm quite disappointed since it broke the Docker demon after I tried to uninstall it ! I have tried everything for the past hour, systemd status seems fine but every else commands are broken. Tried to reinstall, to stop and start, restart, erase my home ~/.docker/dekstop/docker.sock Also tried the procedure from the docker documentation : https://docs.docker.com/desktop/linux/install/ Changing context, clean packaging on my machine to purge necessary files. And after removing et reinstalling both engine and desktop nothing works now ! If anyone know a fix let me know ! Best regards.

Error : 

2637 ± : docker run -d -p 80:80 docker/getting-started                                                                                                                                                                     [176d7h22m] ✹ ✭
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.


2635 ± : docker ps                                                                                              ⏎ [176d7h17m] ✹ ✭
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

sudo systemctl status docker

● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
     Active: active (running) since Fri 2022-05-13 23:24:42 CEST; 7min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 459784 (dockerd)
      Tasks: 19
     Memory: 38.6M
        CPU: 377ms
     CGroup: /system.slice/docker.service
             └─459784 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

May 13 23:24:42 fedora dockerd[459784]: time="2022-05-13T23:24:42.432366216+02:00" level=info msg="Firewalld: interface docker0 already part of docker zone, returning"
May 13 23:24:42 fedora dockerd[459784]: time="2022-05-13T23:24:42.691614331+02:00" level=error msg="stream copy error: reading from a closed fifo"
May 13 23:24:42 fedora dockerd[459784]: time="2022-05-13T23:24:42.692266578+02:00" level=error msg="stream copy error: reading from a closed fifo"
May 13 23:24:42 fedora dockerd[459784]: time="2022-05-13T23:24:42.822133749+02:00" level=error msg="898530aad5dc0779a0e14de978164a1c9d8d174c19b0d42a4e748e20f2472525 cleanup: failed to delete container from containerd: no such containe>
May 13 23:24:42 fedora dockerd[459784]: time="2022-05-13T23:24:42.822163883+02:00" level=error msg="failed to start container" container=898530aad5dc0779a0e14de978164a1c9d8d174c19b0d42a4e748e20f2472525 error="failed to create shim tas>
May 13 23:24:42 fedora dockerd[459784]: time="2022-05-13T23:24:42.822764041+02:00" level=info msg="Loading containers: done."
May 13 23:24:42 fedora dockerd[459784]: time="2022-05-13T23:24:42.854118607+02:00" level=info msg="Docker daemon" commit=f756502 graphdriver(s)=overlay2 version=20.10.16
May 13 23:24:42 fedora dockerd[459784]: time="2022-05-13T23:24:42.854364744+02:00" level=info msg="Daemon has completed initialization"
May 13 23:24:42 fedora systemd[1]: Started Docker Application Container Engine.
May 13 23:24:42 fedora dockerd[459784]: time="2022-05-13T23:24:42.898428261+02:00" level=info msg="API listen on /run/docker.sock"

M41doror avatar May 13 '22 21:05 M41doror

I have the same problem. I have a debian 10 with docker 20.10.14, accessible as user. After installing docker-desktop, docker command as user does not connect any more to the daemon. I tried with root, with success, so after some test, I copied the .docker map to the users homedir. After that, the user can access again the docker daemon, but when starting docker-desktop, it is broken again.

The status of the daemon is like above, but the path is not the same as in the error message: unix:///srv/dev-disk-by-id-md/home/$userid/.docker/desktop/docker.sock

Now I try to find a way to set the correct path like in the status of the daemon: containerd=/run/containerd/containerd.sock

When I check the context, both are available. When I switch to the default (unix://var.run/docker.sock), the CLI docker works again, but Docker Desktop not.

Maybe I mix up docker daemon and containerd, but I guess this is the fault. I didn't find a solution yet.

Some screenshots:

  • Before running Docker Desktop: BeforeDockerDesktop

  • Running Docker Desktop: Schermafbeelding 2022-05-17 om 08 52 24

  • After running Docker Desktop: AfterDockerDesktop

BlackElkX avatar May 17 '22 06:05 BlackElkX

Let me move this one to the https://github.com/docker/desktop-linux issue tracker which is for Docker Desktop for Linux

thaJeztah avatar May 18 '22 08:05 thaJeztah

@M31MOTH - could you try following https://docs.docker.com/desktop/linux/install/#uninstall-docker-desktop, and failing that try to remove ~/.docker (of course, don't forget to back it up if you are worried about losing some aspect of your config)?

@BlackElkX - I am not sure if I follow, but if you copied the contents of .docker from root to your user (~/.docker) there is a good chance it would break Desktop (because it would lose state files it relies on, also I would be worried about if everything has the correct access rights). Also, do you mean that before doing that if you switched the context to default (docker context use default) while running Desktop, you would not be able to connect to the regular daemon?

p1-0tr avatar May 18 '22 09:05 p1-0tr

for me, following the instructions linked by @p1-0tr did the trick. I uninstalled docker desktop and then removed the two lines from ~/.docker/config.json, now at least docker is working, again.

debian v11 (Kernel: Linux 5.10.0-15-amd64) docker v20.10.17 docker-dektop v4.10.0

dkress59 avatar Jul 04 '22 20:07 dkress59

@p1-0tr's solution worked for me too.

Ubuntu 22.04.1 LTS (Kernel: Linux 5.15.0-46-generic) docker v20.10.13

elmaxe avatar Aug 16 '22 07:08 elmaxe

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

oktayderman avatar Aug 21 '22 11:08 oktayderman

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

this worked for me thanks

Fabricio-Joaquim avatar Aug 25 '22 20:08 Fabricio-Joaquim

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

Thanks, this did the trick !

vladimir-gal avatar Sep 15 '22 10:09 vladimir-gal

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

This work for me, I've been looking for this solution all the places. But, after I restart the PC, it went back to desktop-linux

kimmohito avatar Sep 30 '22 03:09 kimmohito

Switching docker context with docker context use default worked for me

Dmaina5054 avatar Nov 29 '22 12:11 Dmaina5054

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

Found this to be the simplest way to fix this issue.

thanks @oktaycekmez

soodssr avatar Dec 19 '22 16:12 soodssr

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

Totally, that exactly answer I need

quanhieu avatar Dec 31 '22 07:12 quanhieu

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 30 days.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robott avatar Mar 31 '23 01:03 docker-robott

/remove-lifecycle stale

psilvaricardo avatar Apr 02 '23 01:04 psilvaricardo

Didn't work for me. I didn't install docker engine beforehand. Only Docker-desktop follow this guide https://docs.docker.com/desktop/install/ubuntu/ It works straight, build and run images. Someday after an apt upgrade, it stop working. I suspect something related to newly poped up keyring. But clueless.

sonvirgo avatar Apr 21 '23 08:04 sonvirgo

Personally, I forget to unable the Enable default Docker socket. It's allows to creates /var/run/docker.sock which some third-party clients may use to communicate with Docker Desktop.

To solve this, go to Settings -> Advanced -> check the option Enable default Docker socket (Requires password). No need to restart Docker.

XavierChevalier avatar Apr 24 '23 07:04 XavierChevalier

Remove all docker-desktop and install docker-engine work for me.

sonvirgo avatar Apr 24 '23 08:04 sonvirgo

Tried the

Personally, I forget to unable the Enable default Docker socket. It's allows to creates /var/run/docker.sock which some third-party clients may use to communicate with Docker Desktop.

To solve this, go to Settings -> Advanced -> check the option Enable default Docker socket (Requires password). No need to restart Docker.

This looks like the solution, but cannot find Advanced in Settings :-(

jorgeas80 avatar Sep 28 '23 09:09 jorgeas80

i just encountered this problem, and discovered that running docker as non-root with the presence of things in $HOME/.docker it expects to find the socket in there:

docker: Cannot connect to the Docker daemon at unix:///home/me/.docker/desktop/docker.sock. Is the docker daemon running?.

i just now solved this problem thusly:

[me@ip3 client]$ sudo rm -rf ~/.docker
[me@ip3 client]$ docker run -it --rm archlinux bash -c "echo hello world"
Unable to find image 'archlinux:latest' locally
latest: Pulling from library/archlinux
5f77560258b9: Pull complete 
d45fbe0d533b: Pull complete 
Digest: sha256:c104009b470ee7866c42cbfc491aba018efe5e157184302ed5dcffda569adbda
Status: Downloaded newer image for archlinux:latest
hello world

mleku avatar Nov 06 '23 07:11 mleku

I can not find the "Settings -> Advanced" configuration in the Ubuntu version of DD...

speller avatar Nov 06 '23 08:11 speller

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

Thanks a lot. It helps me, but I cant understand whyyyyyyy

StilllHere avatar Nov 11 '23 16:11 StilllHere

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

thanks it works

chadwick-yao avatar Nov 16 '23 15:11 chadwick-yao

This looks like the solution, but cannot find Advanced in Settings :-(

Neither did I, seems to no advanced settings in docker-desktop for debian. However this seems to helped me:

docker context use desktop-linux

achepukov avatar Dec 20 '23 08:12 achepukov

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

Thanks!! it works

dldutod4 avatar Jan 09 '24 06:01 dldutod4

So i removed docker-desktop with sudo apt-get purge docker-desktop, but i still got the same error docker: Cannot connect to the Docker daemon at unix:///home/tanjil/.docker/desktop/docker.sock. Is the docker daemon running?.

tskxz avatar Feb 12 '24 21:02 tskxz

So i removed docker-desktop with sudo apt-get purge docker-desktop, but i still got the same error docker: Cannot connect to the Docker daemon at unix:///home/tanjil/.docker/desktop/docker.sock. Is the docker daemon running?.

Ok i just needed to run as sudo and it works

tskxz avatar Feb 12 '24 21:02 tskxz

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

This worked for me as well.

Aamirmuhammad91 avatar Mar 11 '24 13:03 Aamirmuhammad91

docker context use default work for me

mion-kr avatar Mar 15 '24 01:03 mion-kr

I just solved this problem using run the command sudo rm -rf ~/.docker

GausAlMunirTushar avatar May 06 '24 06:05 GausAlMunirTushar

just switch to default context, after installed docker desktop docker cli commands is being forwarded to docker desktop instead of docker engine

docker context ls docker context use default

Thanks, that works for me.

NeuronioAzul avatar May 23 '24 00:05 NeuronioAzul