假设我们要在 linux 服务器上执行两条需要 sudo 权限的命令,比如 "docker ps -a" 和 "docker images"
不使用 sudo 无法执行 docker ps -a。$ docker ps -a
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.39/containers/json?all=1: dial unix /var/run/docker.sock: connect: permission denied