Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
M41doror opened this issue May 13, 2022 · 32 comments

Comments

@M41doror
Copy link

M41doror commented May 13, 2022

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"
@BlackElkX
Copy link

BlackElkX commented May 17, 2022

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

@thaJeztah
Copy link
Member

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

@thaJeztah thaJeztah transferred this issue from docker/for-linux May 18, 2022
@p1-0tr
Copy link
Member

p1-0tr commented May 18, 2022

@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?

@dkress59
Copy link

dkress59 commented Jul 4, 2022

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

@elmaxe
Copy link

elmaxe commented Aug 16, 2022

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

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

@oktayderman
Copy link

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

@Fabricio-Joaquim
Copy link

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

@vladimir-gal
Copy link

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 !

@kimmohito
Copy link

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

@Dmaina5054
Copy link

Switching docker context with docker context use default worked for me

@soodssr
Copy link

soodssr commented Dec 19, 2022

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

@quanhieu
Copy link

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

@docker-robott
Copy link
Collaborator

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

@psilvaricardo
Copy link

/remove-lifecycle stale

@sonvirgo
Copy link

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.

@XavierChevalier
Copy link

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.

@sonvirgo
Copy link

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

@jorgeas80
Copy link

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 :-(

@mleku
Copy link

mleku commented Nov 6, 2023

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

@speller
Copy link

speller commented Nov 6, 2023

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

@StilllHere
Copy link

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

@chadwick-yao
Copy link

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

@achepukov
Copy link

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

@dldutod4
Copy link

dldutod4 commented Jan 9, 2024

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

@tskxz
Copy link

tskxz commented Feb 12, 2024

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
Copy link

tskxz commented Feb 12, 2024

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

@Aamirmuhammad91
Copy link

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.

@mion-kr
Copy link

mion-kr commented Mar 15, 2024

docker context use default
work for me

@GausAlMunirTushar
Copy link

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

@NeuronioAzul
Copy link

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.

@rumus-bin
Copy link

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

Ubuntu 24.04.1 LTS
Docker Engine v27.1.1

@lgrando1
Copy link

lgrando1 commented Oct 5, 2024

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 saves 32 GB of my storage. Thanks so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests