dive icon indicating copy to clipboard operation
dive copied to clipboard

Question: how to inspect local image?

Open qsLI opened this issue 3 years ago • 28 comments

Can we skip pulling from hub,using local image insted? My image is imported via command docker load -i, and it's not avaliable in registry.

qsLI avatar Jul 29 '21 10:07 qsLI

For me it simply worked by using dive 482ca299fbe2. You can just put the image id or name / tag in there. Fetching image does not mean it's being pulled from Docker Hub, it's just fetching the image from the Docker Daemon as far as I understood.

dunklesToast avatar Aug 03 '21 16:08 dunklesToast

Does inspecting a local image create large temporary files? and where are they stored?

indera-shsp avatar Aug 23 '21 18:08 indera-shsp

@indera-shsp at least for podman inspecting uses podman image save which streams image in .tar format to stdout.

https://github.com/wagoodman/dive/blob/c7d121b3d72aeaded26d5731819afaf49b686df6/dive/image/podman/resolver_linux.go#L36

Then the image is parsed on the fly.

https://github.com/wagoodman/dive/blob/c7d121b3d72aeaded26d5731819afaf49b686df6/dive/image/docker/image_archive.go#L23

abitrolly avatar Oct 11 '21 06:10 abitrolly

I have similar problem.

dive fbbae5f27e2a
Image Source: docker://fbbae5f27e2a
Fetching image... (this can take a while for large images)
Handler not available locally. Trying to pull 'fbbae5f27e2a'...
Using default tag: latest
Error response from daemon: failed to resolve reference "docker.io/library/fbbae5f27e2a:latest": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
cannot fetch image
exit status 1

This is local image, not available on hub. In above example I trying to dive via image id, but I also tried with image tag and get the same output.

oskar-gmerek avatar Aug 09 '23 16:08 oskar-gmerek

Still not possible to dive into local image neither by its name, nor by id. dive 40bea9d7fd53 gives cannot fetch image docker inspect 40bea9d7fd53 succeeds!

Workaround is wrappring into script like:

IMAGE_NAME="${1}"
TMP_FILE=/tmp/dive-tmp-image.tar
docker save "$IMAGE_NAME" > $TMP_FILE && dive $TMP_FILE --source=docker-archive && rm $TMP_FILE

fedulovivan avatar Sep 20 '23 08:09 fedulovivan

this definitely used to work for me (way after this issue was opened), i thought i was crazy and i see everyone else can't dive b2b32512c2cf i'm using docker desktop and maybe dive is trying to use the default context?

dive b2b32512c2cf
Image Source: docker://b2b32512c2cf
Fetching image... (this can take a while for large images)
Handler not available locally. Trying to pull 'b2b32512c2cf'...
Using default tag: latest
Error response from daemon: pull access denied for b2b32512c2cf, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
cannot fetch image
exit status 1

yehudamakarov avatar Dec 20 '23 19:12 yehudamakarov

@yehudamakarov could you try building the branch fix/docker-context from source and test it out to see if it helps?

Just running go run main.go b2b32512c2cf should work.

mark2185 avatar Dec 22 '23 07:12 mark2185

I had the same question of how to inspect a local docker image in a tarball.

The docker image I am working with is built by nix using dockerTools, so it is a gzipped tarball.

I was able to easily inspect it with dive like the following:

$ nix-build ... # build the docker image
...
/nix/store/q9hl1xlcyglqlc4jp0yzm7riajjymmrg-my-docker-image.tar.gz
$ dive --source docker-archive <(gunzip -c /nix/store/q9hl1xlcyglqlc4jp0yzm7riajjymmrg-my-docker-image.tar.gz)

This uses gunzip to unzip the tarball on the fly, and pass the unzipped tarball to dive.

cdepillabout avatar Jan 09 '24 06:01 cdepillabout

Same as @yehudamakarov, it used to work for me, but it does not anymore. I tried @mark2185's solution, but it does not seem to work either:

cannot fetch image
could not find image config
exit status 1

EDIT : I was running version 0.11.0, and upgrading to 0.12.0 seemed to solve the problem.

iamludal avatar Apr 01 '24 23:04 iamludal

this is annoying

mikejwhat avatar Apr 09 '24 17:04 mikejwhat

I upgraded to version 0.12.0 on Darwin and it works for me now.

3manuek avatar Apr 22 '24 12:04 3manuek

i've been noticing it has been working for me not sure what the difference is. i was on 0.11.0

yehudamakarov avatar May 06 '24 18:05 yehudamakarov

Still having this issue on macOS 14.3. Updated dive to 0.12 and Docker Desktop to 4.30.0. Didn't help. Any more ideas?

Image Source: docker://1717b97bca46
Fetching image... (this can take a while for large images)
Handler not available locally. Trying to pull '1717b97bca46'...
Using default tag: latest
Error response from daemon: pull access denied for 1717b97bca46, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
cannot fetch image
exit status 1

parallaxe avatar May 15 '24 11:05 parallaxe