wagoodman / dive

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

Dive don't find local images with docker desktop #542

Open mathieuarthur opened 4 months ago

mathieuarthur commented 4 months ago

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:

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
RafaelWO commented 4 months ago

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
mark2185 commented 4 months ago

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

$> docker context ls
RafaelWO commented 3 months ago

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

mark2185 commented 3 months ago

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

RafaelWO commented 3 months ago

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!

mathieuarthur commented 3 months ago

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.

erhhung commented 3 months ago

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.

pjonsson commented 3 months ago

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.

jedrekdomanski commented 2 months ago

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
ms-semarchy commented 2 months ago

For those who use OrbStack on MacOS,

to make it work run

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

xiaoyao9184 commented 4 days ago

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