run dive without sudo
When I run dive test:latest I get:
Image Source: docker://test:latest
Extracting image from docker-engine... (this can take a while for large images)
> could not determine docker host: context "default": context not found: open /home/john/.docker/contexts/meta/37a8eec1ce19687d132fe29051dca629d164e2c4958ba141d5f4133a33f0688f/meta.json: no such file or directory
cannot fetch image
unable to parse docker host ``
Conversely when I run it with sudo, sudo dive test:latest, it works. Is there a way to run dive without using sudo? I was expecting not to need sudo given that my user (the one that is running dive) is already associated to the docker group that is the one need to connect to the Docker daemon and the dive process should inherit my supplementary groups.
Hello Sir, This issue is not related to Dive itself, but to the fact that your user does not have access to the Docker daemon’s Unix socket:
/var/run/docker.sock
1. Check your current groups:
groups
If you do not see the docker group listed, this is the problem.
2. Add your user to the docker group:
sudo usermod -aG docker $USER
You must logout and login again
4. After logging in again, test:
docker ps
dive test:latest
Both commands should now work without sudo.
@tree-1917 This is the error I get sometimes if I do not sudo:
Image Source: docker://**************** Extracting image from docker-engine... (this can take a while for large images) could not determine docker host: context "default": context not found: open /home/John/.docker/contexts/meta/37a8eec1ce19687d132fe29051dca629d164e2c4958ba141d5f4133a33f0688f/meta.json: no such file or directory cannot fetch image unable to parse docker host ``
but if then I prepend sudo it works.
Hello @dp-anto,
can first list all current context :
docker context ls
As your error message indicates, the default context cannot be found. If the default context does not exist, you can create it with:
docker context create default
and it should works without needing sudo.