dive icon indicating copy to clipboard operation
dive copied to clipboard

Unable to connect to docker.sock file while running dive

Open hariprasadpo28 opened this issue 1 year ago • 13 comments

I have been trying to run dive on some of my images, after running dive ubuntu:latest I am seeing this error:

Image Source: docker://ubuntu:latest Fetching image... (this can take a while for large images) Handler not available locally. Trying to pull 'ubuntu:latest'... latest: Pulling from library/ubuntu Digest: sha256:dfd64a3b4296d8c9b62aa3309984f8620b98d87e47492599ee20739e8eb54fbf Status: Image is up to date for ubuntu:latest docker.io/library/ubuntu:latest cannot fetch image Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

But I am able to use docker without any problems, docker is also running. OS: MacOS 13.4 Docker engine: v23.0.5

hariprasadpo28 avatar May 24 '23 18:05 hariprasadpo28

Edit 2023-07-10 A better solution is described by @Tantalor93 below https://github.com/wagoodman/dive/issues/453#issuecomment-1627487747

Original proposed solution I had the same problem, but this is not an issue related to dive, this is more related to Docker and how docker.sock seems to be managed on Mac now.

A Docker upgrade on Mac moved the docker.sock from /var/run/ to ~/.docker/run/

An easy fix is:

ln -s ~/.docker/run/docker.sock /var/run/docker.sock

If sudo is required:

sudo ln -s ~/.docker/run/docker.sock /var/run/docker.sock

Note sure how long this fix can work, but for now, it is doing the job!

kfrapin avatar Jun 02 '23 08:06 kfrapin

If you are using Docker Desktop on Mac, you can enable the option for creating the default Docker socket image

Tantalor93 avatar Jul 08 '23 20:07 Tantalor93

This looks like a change in Docker Desktop 4.18 to allow installation on macOS without needing admin privileges: https://www.docker.com/blog/docker-desktop-4-18/ . It still asks for admin privileges, but if you don't grant them then tools like dive won't work until you enable this new setting.

jmbowman avatar Jul 17 '23 16:07 jmbowman

This could be worth adding as a note to the installation steps. I ran into this issue too!

I haven't used my personal computer in quite a long time for programming. My Docker client updated itself to Docker Desktop - and at no point during the upgrade process did it prompt me for a password (and luckily I kind of stumbled onto this fix myself) 😅

nigelwtf avatar Jul 18 '23 23:07 nigelwtf

I get a similar error since I switched from Docker Desktop to colima at my MacBook (Ventura 13.3.1). Dive (0.11.0) can not load a local image. Docker version is 24.0.4.

$>dive a6cfd372bba2
Image Source: docker://a6cfd372bba2
Fetching image... (this can take a while for large images)
Handler not available locally. Trying to pull 'a6cfd372bba2'...
Using default tag: latest
Error response from daemon: pull access denied for a6cfd372bba2, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
cannot fetch image
exit status 1

diei avatar Jul 19 '23 14:07 diei

The post of TG-KK in https://github.com/wagoodman/dive/issues/397#issuecomment-1197249019 helped me.

diei avatar Jul 20 '23 09:07 diei

For docker rootless: sudo ln -s /run/user/$(id -u)/docker.sock /var/run/docker.sock

williamdes avatar May 20 '24 09:05 williamdes

Awesome @Tantalor93 - this was sooo annoying thank you :)

cjconnor24 avatar Aug 01 '24 10:08 cjconnor24