dive
dive copied to clipboard
Question: how to inspect local image?
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.
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.
Does inspecting a local image create large temporary files? and where are they stored?
@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
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.
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
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 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.
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
.
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.
this is annoying
I upgraded to version 0.12.0 on Darwin and it works for me now.
i've been noticing it has been working for me not sure what the difference is. i was on 0.11.0
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