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

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

Open
mathieuarthur opened this issue Jul 25, 2024 · 12 comments
Open

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

mathieuarthur opened this issue Jul 25, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@mathieuarthur
Copy link

mathieuarthur commented Jul 25, 2024

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 mathieuarthur added the bug Something isn't working label Jul 25, 2024
@RafaelWO
Copy link

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

@mark2185
Copy link
Contributor

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

$> docker context ls

@RafaelWO
Copy link

@mark2185 I only have one context 🤔

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

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

@RafaelWO
Copy link

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

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

erhhung commented Aug 4, 2024

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

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

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

ms-semarchy commented Sep 16, 2024

For those who use OrbStack on MacOS,

to make it work run

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

@xiaoyao9184
Copy link

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

@deftdawg
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants