This blog shows you, How to fix docker ‘Got permission denied while trying to connect to the Docker daemon socket’. To run docker as non-root user then you need to add it to the docker group.
The Docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user
root and other users can only access it using
sudo. The Docker daemon always runs as the
Following are the steps to fix the permission denied issue.
- Create the docker group.
$ sudo groupadd docker
- Add your user to the docker group.
$ sudo usermod -aG docker $USER
- Log out and log back in so that your group membership is re-evaluated. If testing on a virtual machine, it may be necessary to restart the virtual machine for changes to take effect.
$ docker images