wagoodman / dive

A tool for exploring each layer in a docker image
MIT License
44.64k stars 1.69k forks source link

Rancher Desktop #416

Open StiviiK opened 1 year ago

StiviiK commented 1 year ago

Many started using Rancher Desktop with containerd and nerdctl as replacement for Docker Desktop on MacOS. Are there any plans for Dive to support Rancher Desktop / the bundled containerd?

yaron commented 1 year ago

You can use Dive with Rancher Desktop if you set the container engine to dockerd and allow administrative access to make it create the default docker socket for dive to use.

alecxvs commented 1 year ago

Is there a configuration to change the socket location it's trying to use instead of overriding the default docker socket?

gavvvr commented 8 months ago

Hi. I just switched to Rancher Desktop on Mac (Apple Silicon) and getting: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? on attempt to use Dive. In the very end, already after the missing image got downloaded. I have no idea how it works, but Dive somehow is able to trigger image download and only after that fails.

Complete log ``` ❯ dive hello-world Image Source: docker://hello-world Fetching image... (this can take a while for large images) Handler not available locally. Trying to pull 'hello-world'... Using default tag: latest latest: Pulling from library/hello-world 70f5ac315c5a: Pull complete Digest: sha256:88ec0acaa3ec199d3b7eaf73588f4518c25f9d34f58ce9a0df68429c5af48e8d Status: Downloaded newer image for hello-world:latest docker.io/library/hello-world:latest cannot fetch image Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ```

Is it related to the subject of this issue?

Additional observation: I get the same: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? on attempt to execute docker run hello-world while Rancher Desktop is turned off (quite expected).

Complete log ``` ❯ docker run hello-world docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See 'docker run --help'. ```

However, when I turn on Rancher Desktop the docker run starts working as expected, but Dive doesn't.

You can use Dive with Rancher Desktop if you set the container engine to dockerd and allow administrative access to make it create the default docker socket for dive to use.

@yaron could you please elaborate a little bit more on your suggestion? I've already chosen dockerd as a default engine in Rancher config. What do you mean by "allow administrative access to make it create the default docker socket for dive to use"?

harmjanblok commented 7 months ago

For me setting the DOCKER_HOST worked:

env DOCKER_HOST=unix:////Users/me/.rd/docker.sock dive ...

The endpoint is listed in the docker contexts:

docker context ls
NAME                DESCRIPTION                               DOCKER ENDPOINT                           ERROR
default             Current DOCKER_HOST based configuration   unix:///var/run/docker.sock
rancher-desktop *                                             unix:////Users/me/.rd/docker.sock
gavvvr commented 7 months ago

Thank you @harmjanblok That worked for me too!