wagoodman/dive

Cannot analyze through docker desktop

jamie-at-arkifi opened this issue ยท 15 comments

What happened:

I'm trying to analyze a multi-gigabyte local image, and it's just failing with "could not find image config"

๐Ÿš dive myapp:latest
Image Source: docker://myapp:latest
Fetching image... (this can take a while for large images)
cannot fetch image
could not find image config
๐Ÿš dive build .
Building image...
[REDACTED, but apparently successful]

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/9k057vmr8hx8ldwxbgravqng5
cannot build image
could not find image config

What you expected to happen:

Analysis

How to reproduce it (as minimally and precisely as possible):

Honestly, I'm not sure what's going on to begin narrowing it down. It's a 3+GB image and not published to a registry.

Anything else we need to know?:

Some kind of --verbose might make tracking this down easier.

Buildx is being used.

Environment:

  • OS version: Mac OSX 14.0
  • Docker version: Docker Desktop for Mac 4.26.1, Docker Engine 24.0.7

I think this might be a docker desktop thing?

dive python:3.11 doesn't work either.

Running through the container (instead of the brew version) has the same result in both cases.

Could you please try building dive from source? Specifically PR #490.

(Some build instructions would help a bunch.)

Does not seem to--built 326d463 and ~/src/dive/snapshot/dive_darwin_arm64/dive build . seems to be doing the same thing.

Download the fork, checkout the right branch from that fork and run go run main.go python:3.11 from the root of the clone.

jamie@Jamies-MacBook-Pro ~/src/dive 326d463 ๐Ÿš go run main.go python:3.11
Image Source: docker://python:3.11
Fetching image... (this can take a while for large images)
cannot fetch image
could not find image config
exit status 1

By "some build instructions would help", I mean "I spent ten minutes fumbling through the makefile and eventually figured it out, which is not a great experience."

By "some build instructions would help", I mean "I spent ten minutes fumbling through the makefile and eventually figured it out, which is not a great experience."

Ah, sorry, thought it was aimed at me. I do agree with the sentiment, though.

If you're up for diving deeper into the issue, I'd look at where is the socket for docker-desktop located, try running docker context ls, and pointing the variable in docker_host_unix.go to that.

If not, please let me know, will see what I can do.

๐Ÿš docker context list
NAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT                                     KUBERNETES ENDPOINT   ORCHESTRATOR
default             moby                Current DOCKER_HOST based configuration   unix:///var/run/docker.sock
desktop-linux *     moby                Docker Desktop                            unix:///Users/jamie/.docker/run/docker.sock

Would you kindly try replacing that line indocker_host_unix.go with unix:///Users/jamie/.docker/run/docker.sock and try it with some image again?

jamie@Jamies-MacBook-Pro ~/src/dive 326d463 ๐Ÿš git diff
diff --git a/dive/image/docker/docker_host_unix.go b/dive/image/docker/docker_host_unix.go
index 52dae70..c93781d 100644
--- a/dive/image/docker/docker_host_unix.go
+++ b/dive/image/docker/docker_host_unix.go
@@ -3,5 +3,5 @@
 package docker

 const (
-       defaultDockerHost = "unix:///var/run/docker.sock"
+       defaultDockerHost = "unix:///Users/jamie/.docker/run/docker.sock"
 )
jamie@Jamies-MacBook-Pro ~/src/dive 326d463 ๐Ÿš go run main.go python:3.11
Image Source: docker://python:3.11
Fetching image... (this can take a while for large images)
cannot fetch image
could not find image config
exit status 1

Alright, thanks!

Until that's fixed I'd recommend saving the image to a file and then passing the archive to dive, should be an example under --help.

FYI, you don't have to change the defaultDockerHost. You can just export DOCKER_HOST with the desired value. For example, export DOCKER_HOST=unix:///Users/jamie/.docker/run/docker.sock as a workaround until #490 is merged.

@rajiv-k but if I'm reading it right, it's not working even after changing the host socket.

@mark2185 try like this :D

sudo ln -s /Users/yunsang/.docker/run/docker.sock /var/run/docker.sock

I have the same problem and sudo ln -s <MY_SOCK_PATH> /var/run/docker.sock results in ln: /var/run/docker.sock: File exists.

tko commented

FWIW with Docker Desktop on Mac it's a symlink in /var/run

lrwxr-xr-x  1 root  daemon  42 Feb 19 10:12 /var/run/docker.sock -> /Users/test/.docker/run/docker.sock
srwxr-xr-x  1 test  staff    0 Feb 20 20:44 /Users/test/.docker/run/docker.sock

overriding DOCKER_HOST doesn't seem to make any difference for me.