Docker Image Ls fails with permission denied

When I tried docker image ls as sudo user, I am getting

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.37/images/json: dial unix /var/run/docker.sock: connect: permission denied

I can execute docker image and it simply returns with typical message:

mmpc@mydockervm:/$ docker image

Usage:  docker image COMMAND

Manage images

Options:


Commands:
  build       Build an image from a Dockerfile
  history     Show the history of an image
  import      Import the contents from a tarball to create a filesystem image
  inspect     Display detailed information on one or more images
  load        Load an image from a tar archive or STDIN
  ls          List images
  prune       Remove unused images
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rm          Remove one or more images
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

But i have already added this user to docker group. It works when I do sudo docker image ls. Is this because ‘ls’ command has restricted usage?

Bouncing the shell was the solution :frowning:

I also found this - Unable to use docker without sudo

Thanks,