wagoodman / dive

A tool for exploring each layer in a docker image
MIT License
47.4k stars 1.79k forks source link

Dive always fail when trying to fetch local image #462

Closed joaocasarin closed 1 year ago

joaocasarin commented 1 year ago

I have a local image called jcasarin:t with id d18bf00f8397. When I run dive d18bf00f8397 or dive jcasarin:t it always fail with the following response:

Image Source: docker://d18bf00f8397
Fetching image... (this can take a while for large images)
Handler not available locally. Trying to pull 'd18bf00f8397'...
Using default tag: latest

Error response from daemon: pull access denied for d18bf00f8397, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
cannot fetch image
exit status 1

Although fetching image doesn't necessarily means it is pulling from docker hub, it does seem to be trying to do that.

I have already ran docker login docker.io and also docker login <my_company_docker_registry> and both are already authenticated, but still get that deny error.

PS.: I did not push the image to any registry, it is just local!

mark2185 commented 1 year ago
Handler not available locally. Trying to pull 'd18bf00f8397'...
Using default tag: latest

This means it will try to pull an image named d18bf00f8397 with the tag latest which is not what you want.

Could you please post the output of docker images | grep jcasarin and dive jcasarin:t?

Also, which version of dive are you using?

joaocasarin commented 1 year ago

Hi @mark2185 , as requested this is the output of the first command:

image

second command:

image

dive version: dive 0.10.0

jmbowman commented 1 year ago

I suspect this is the same issue resolved by https://github.com/wagoodman/dive/issues/453#issuecomment-1627487747 . It happens when newer versions of Docker Desktop are installed without admin privileges on macOS.

joaocasarin commented 1 year ago

@jmbowman interesting, perhaps it has something to do with the docker client I am using then. We are not allowed to use Docker Desktop so we have an internal docker client, may that be the cause?

grumpyp commented 1 year ago

maybe also related to: #452

joske commented 1 year ago

I have the same issue on macOS. Using colima as docker engine. Dive tries to pull the image (and fails) while it's just available locally.

joaocasarin commented 1 year ago

Hi, just wanted to share here I found the solution for our internal tool. We needed to export following environment variables:

DOCKER_CERT_PATH=$(docker context inspect -f '{{ .Storage.TLSPath }}/docker')
DOCKER_HOST=$(docker context inspect -f '{{ .Endpoints.docker.Host }}')
DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH DOCKER_HOST DOCKER_TLS_VERIFY

After doing that, I could use dive as usual in the current terminal session.

maybe you want to take a look about these variables with the dev of colima, @joske ?

baggiponte commented 1 year ago

maybe you want to take a look about these variables with the dev of colima, @joske ?

Hi @joaocasarin, I am using colima too and just found I have the same problem. Are you saying I should export those variables and see if this works for colima as well? Thanks!

EDIT: I tried this and this is the error that was raised:

Image Source: docker://omi-kml
Fetching image... (this can take a while for large images)
cannot fetch image
could not read CA certificate "/Users/luca/.docker/contexts/tls/f24fd3749c1368328e2b149bec149cb6795619f244c5b584e844961215dadd16/docker/ca.pem": open /Users/luca/.docker/contexts/tls/f24fd3749c1368328e2b149bec149cb6795619f244c5b584e844
961215dadd16/docker/ca.pem: no such file or directory

I am not sure where colima stores the certificates..

joaocasarin commented 1 year ago

maybe you want to take a look about these variables with the dev of colima, @joske ?

Hi @joaocasarin, I am using colima too and just found I have the same problem. Are you saying I should export those variables and see if this works for colima as well? Thanks!

EDIT: I tried this and this is the error that was raised:

Image Source: docker://omi-kml
Fetching image... (this can take a while for large images)
cannot fetch image
could not read CA certificate "/Users/luca/.docker/contexts/tls/f24fd3749c1368328e2b149bec149cb6795619f244c5b584e844961215dadd16/docker/ca.pem": open /Users/luca/.docker/contexts/tls/f24fd3749c1368328e2b149bec149cb6795619f244c5b584e844
961215dadd16/docker/ca.pem: no such file or directory

I am not sure where colima stores the certificates..

Hi, actually I use our own internal implementation of docker engine, not Colima. I was told about those variables so we could use Dive, but probably the developers of Colima should know better what to do in order to get it working as well...

Perhaps you open an issue on Colima's repo and mention this thread?

arunvelsriram commented 3 months ago

Setting DOCKER_HOST correctly solved the issue for me.

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