dive icon indicating copy to clipboard operation
dive copied to clipboard

Dive don't find local images with docker desktop

Open mathieuarthur opened this issue 1 year ago • 22 comments

What happened: I'm unable to fetch for local images using dive

What you expected to happen: I expect to be able to inspect images locally

How to reproduce it (as minimally and precisely as possible): Just install latest dive and docker version, build an image and try to inspect it

Environment:

  • OS version : Ubuntu 22.04
  • Docker version (if applicable): Docker version 27.0.3, build 7d4bcd8
  • Dive version : 0.12.0

Here is what it look like :

$ docker images
REPOSITORY      TAG       IMAGE ID       CREATED       SIZE
work-database   latest    c777209c4241   6 days ago    796MB
work-frontend   latest    ba1bcaf3bdb9   5 weeks ago   150MB
work-backend    latest    d4f717757028   5 weeks ago   129MB
dive work-database:latest
Image Source: docker://work-database:latest
Fetching image... (this can take a while for large images)
Handler not available locally. Trying to pull 'work-database:latest'...
Error response from daemon: Get "https://registry-1.docker.io/v2/": dialing registry-1.docker.io:443 container via direct connection because  has no HTTPS proxy: resolving host registry-1.docker.io: lookup registry-1.docker.io on 127.0.0.53:53: no such host
cannot fetch image
exit status 1

mathieuarthur avatar Jul 25 '24 13:07 mathieuarthur

I had a lot of local docker images but after I installed dive via sudo snap install dive they are gone :open_mouth:

$ docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

RafaelWO avatar Jul 30 '24 08:07 RafaelWO

@RafaelWO dive probably didn't affect that, check your docker context and switch it if needed:

$> docker context ls

mark2185 avatar Jul 30 '24 08:07 mark2185

@mark2185 I only have one context :thinking:

$ docker context ls
NAME        DESCRIPTION                               DOCKER ENDPOINT               ERROR
default *   Current DOCKER_HOST based configuration   unix:///var/run/docker.sock

Either way, I removed dive from snap and installed it via the latest .deb file from the GitHub releases.

RafaelWO avatar Jul 31 '24 08:07 RafaelWO

I don't have any other ideas unfortunately, but it's highly unlikely dive deleted your images.

mark2185 avatar Jul 31 '24 08:07 mark2185

I don't have any other ideas unfortunately, but it's highly unlikely dive deleted your images.

I just noticed that apt installed an update of Docker that day which is likely the issue. Sorry for bothering!

RafaelWO avatar Jul 31 '24 12:07 RafaelWO

I had a lot of local docker images but after I installed dive via sudo snap install dive they are gone 😮

$ docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

Pls it is clearly not related to the issue I made can you open another issues.

mathieuarthur avatar Aug 03 '24 16:08 mathieuarthur

I'm running dive 0.12.0 with the latest Docker Desktop 4.33.0 on Intel-based macOS 14.5, and I can reproduce this exact issue.

Through some experimentation, I've narrowed down to having to set the DOCKER_HOST environment variable before running dive on local images:

export DOCKER_HOST=$(docker context inspect -f '{{ .Endpoints.docker.Host }}')

Hope this helps.

erhhung avatar Aug 04 '24 21:08 erhhung

I could also not scan local images with dive 0.12.0 installed from snap on Ubuntu 24.04 with Docker 27.1.1.

I switched to the dive alias from the README that runs dive from a docker image instead, and that finds my local images.

pjonsson avatar Aug 10 '24 11:08 pjonsson

I have the same issue on a Mac with Docker Desktop

docker images
REPOSITORY                        TAG       IMAGE ID       CREATED         SIZE
debian                            latest    b8084b1a576c   9 days ago      205MB
go                                latest    50652a079a53   6 weeks ago     345MB
provectuslabs/kafka-ui            latest    8f2ff02d64b0   5 months ago    411MB
dive debian:latest
Image Source: docker://debian:latest
Fetching image... (this can take a while for large images)
cannot fetch image
could not find image config

jedrekdomanski avatar Sep 14 '24 20:09 jedrekdomanski

For those who use OrbStack on MacOS,

to make it work run

export DOCKER_HOST=$(docker context inspect -f '{{ .Endpoints.docker.Host }}')

ms-semarchy avatar Sep 16 '24 08:09 ms-semarchy

The local image is stuck at 'Fetching image... (this can take a while for large images)'.

xiaoyao9184 avatar Nov 23 '24 09:11 xiaoyao9184

I have this issue as well on MacOS w/ Docker Desktop, docker images ls does correctly list my images, but dive doesn't find them... I noticed that there are 2 contexts when I docker context ls:

 docker context ls
NAME              DESCRIPTION                               DOCKER ENDPOINT                                    ERROR
default           Current DOCKER_HOST based configuration   unix:///var/run/docker.sock
desktop-linux *   Docker Desktop                            unix:///Users/deftdawg/.docker/run/docker.sock
  • DOCKER_HOST isn't set in my environment
  • if I run dive it will fetch docker hub images that are already present locally in my docker images, and it won't find local images I've built.
  • if I prefix the DOCKER_HOST var, DOCKER_HOST=$(docker context inspect -f '{{ .Endpoints.docker.Host }}') dive btop-docker:hcy9ccb27a0470pablkxx7sxpbp88gfp it finds my local images

Seems like dive is assuming the default (unix:///var/run/docker.sock) when DOCKER_HOST isn't defined when perhaps it should be asking docker, either that or Docker Desktop should be defining DOCKER_HOST.

deftdawg avatar Dec 11 '24 11:12 deftdawg

I had a lot of local docker images but after I installed dive via sudo snap install dive they are gone 😮

$ docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

Had the exact same issue. I suspect it is the Ubuntu snap craziness. Installing dive using snap probably force-replaced my non-snap docker install, and the local repo then seems to gets lost.

Really need to get rid of Ubuntu, they mess everything up with that snap abomination.

markmaker avatar Jan 22 '25 11:01 markmaker

export DOCKER_HOST=$(docker context inspect -f '{{ .Endpoints.docker.Host }}') Hope this helps.

This fixed the issue for me (MacOS Colima). There must be a lot of Mac users with alternative runtimes so I've created a PR to update the README.

benjamin-brady avatar Jan 30 '25 20:01 benjamin-brady

export DOCKER_HOST=$(docker context inspect -f '{{ .Endpoints.docker.Host }}') Hope this helps.

This fixed the issue for me (MacOS Colima). There must be a lot of Mac users with alternative runtimes so I've created a PR to update the README.

This doesn't work for me unfortunately :(

jedrekdomanski avatar Jan 30 '25 21:01 jedrekdomanski

If you haven't restarted your Docker process in a while, you may get stuck waiting for images to download with this workaround, click restart on Docker desktop (assuming its safe to do so for whatever containers you might have running), then try again.

deftdawg avatar Jan 30 '25 21:01 deftdawg

If you haven't restarted your Docker process in a while, you may get stuck waiting for images to download with this workaround, click restart on Docker desktop (assuming its safe to do so for whatever containers you might have running), then try again.

I have restarted Docker Desktop multiple times in the past 3 weeks.

jedrekdomanski avatar Jan 30 '25 21:01 jedrekdomanski

I had a lot of local docker images but after I installed dive via sudo snap install dive they are gone 😮

$ docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

Had the exact same issue. I suspect it is the Ubuntu snap craziness. Installing dive using snap probably force-replaced my non-snap docker install, and the local repo then seems to gets lost.

Really need to get rid of Ubuntu, they mess everything up with that snap abomination.

I'm having this same issue right not and I'm really stuck, does anyone have any solution ? It would be much appreciated.

HasYounes avatar Mar 05 '25 23:03 HasYounes

Had the exact same issue. I suspect it is the Ubuntu snap craziness. Installing dive using snap probably force-replaced my non-snap docker install, and the local repo then seems to gets lost.

I'm having this same issue right not and I'm really stuck, does anyone have any solution ? It would be much appreciated.

That looks like #546.

pjonsson avatar Mar 06 '25 10:03 pjonsson

I'm curious if this issue would go away once #569 is implemented. From what I'm reading here it seems like it since stereoscope does not assume a socket paths.

wagoodman avatar Mar 14 '25 14:03 wagoodman

It looks like this is fixed with dive-0.13.1 (and possibly even an earlier version).

I ran across this today on macOS, though the suggestion above to set the DOCKER_HOST endpoint didn't work for me. I noticed I was still using dive-0.12.0, and after upgrading to dive-0.13.1, dive has no issues opening images locally now.

falken42 avatar May 05 '25 13:05 falken42

If you installed dive with snap on Ubuntu.

snap info dive

states that you have to run

sudo snap connect dive:docker-executables docker:docker-executables
sudo snap connect dive:docker-daemon docker:docker-daemon

This worked for me.

falko-apheris avatar Jul 09 '25 21:07 falko-apheris