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

Cannot analyze through docker desktop #495

Open
jamie-at-arkifi opened this issue Jan 17, 2024 · 16 comments
Open

Cannot analyze through docker desktop #495

jamie-at-arkifi opened this issue Jan 17, 2024 · 16 comments
Labels
bug Something isn't working

Comments

@jamie-at-arkifi
Copy link

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
@jamie-at-arkifi jamie-at-arkifi added the bug Something isn't working label Jan 17, 2024
@jamie-at-arkifi jamie-at-arkifi changed the title Cannot analyze large private image Cannot analyze through docker desktop Jan 17, 2024
@jamie-at-arkifi
Copy link
Author

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.

@mark2185
Copy link
Contributor

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

@jamie-at-arkifi
Copy link
Author

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

@mark2185
Copy link
Contributor

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

jamie-at-arkifi commented Jan 18, 2024

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

@mark2185
Copy link
Contributor

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.

@jamie-at-arkifi
Copy link
Author

🐚 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

@mark2185
Copy link
Contributor

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

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

@mark2185
Copy link
Contributor

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.

@rajiv-k
Copy link

rajiv-k commented Jan 22, 2024

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.

@mark2185
Copy link
Contributor

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

@Yunsang-Jeong
Copy link

@mark2185 try like this :D

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

@manuel-koch
Copy link

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

tko commented Feb 21, 2024

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.

@davidbielik
Copy link

Fixed it by enabling this option in Docker Desktop (MacOS) in the "Advanced" tab:

Allow the default Docker socket to be used (requires password)

image

joschi added a commit to joschi/dive that referenced this issue Nov 7, 2024
…oodman#490)

This patch adds support for detecting the "docker host" to connect to which is set in the current docker context.
One can have multiple such contexts and one of them can be activated via `docker context use <context-name>`.

Fixes wagoodman#397
Fixes wagoodman#408
Fixes wagoodman#412
Fixes wagoodman#463
Fixes wagoodman#495

Co-authored-by: Rajiv Kushwaha <raj25by10@gmail.com>
joschi added a commit to joschi/dive that referenced this issue Nov 7, 2024
…oodman#490)

This patch adds support for detecting the "docker host" to connect to which is set in the current docker context.
One can have multiple such contexts and one of them can be activated via `docker context use <context-name>`.

Fixes wagoodman#397
Fixes wagoodman#408
Fixes wagoodman#412
Fixes wagoodman#463
Fixes wagoodman#495

Co-authored-by: Rajiv Kushwaha <raj25by10@gmail.com>
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

7 participants