0

I am new to Ubuntu. When I try to run any of the docker command on Ubuntu 20.0, the terminal shows

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

but when I use sudo with any of the docker commands this runs fine. why is this problem, Please provide the technical information for the Ubuntu system behavior and docker daemon?

James Z
  • 12,209
  • 10
  • 24
  • 44
  • The docker socket (`/var/run/docker.sock`) requires `root` permission to access by default (because generally, access to Docker is equivalent to having `root` access). Using `sudo` gives you `root` privileges, which is why it works. There are [instructions in the documentation](https://docs.docker.com/engine/install/linux-postinstall/) for changing that if you so choose. – larsks Jul 02 '22 at 13:10
  • To run docker without sudo all the time, Add your user to the docker group. (sudo usermod -aG docker $USER) – Shachar297 Jul 02 '22 at 13:30

0 Answers0