Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

Hello! i get this error when i run “fly launch”

WARN Error connecting to local docker daemon: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get “http://%2Fvar%2Frun%2Fdocker.sock/_ping”: dial unix /var/run/docker.sock: connect: permission denied

Same error i have with docker when i run it without sudo.
but i cant run sudo fly, it says “command not found”

upd. Somehow i fixed issue with “command not found” but now it doesnt auth
and i cant use password for auth since i dont have it.

without sudo auth going well, but same permission denied. :frowning:

So i solved this by:

  • Run usermod -aG docker $USER (for fish shell, for bash - “${USER}”)
  • Log out and log back in
  • Restart docker daemon: sudo service docker restart

And running without sudo. Ubuntu 21.04.

Oh I’m sorry we didn’t reply to you! I’m glad you worked it out. If you need to, you can run fly deploy --remote-only and it’ll use a hosted Docker builder (and require less permissions).