issue shows even if the account exists in docker group
# account already been added in `docker` group$idmarslouid=1100(marslo) gid=1100(marslo) groups=1100(marslo),994(docker)$dockerpspermissiondeniedwhiletryingtoconnecttotheDockerdaemonsocketatunix:///var/run/docker.sock:Get"http://%2Fvar%2Frun%2Fdocker.sock/v1.44/containers/json":dialunix/var/run/docker.sock:connect:permissiondenied# group info$getentgroupdockerdocker:x:994:devops,marslo$getentgroup994docker:x:994:devops,marslo# remote$sudogpasswd-dmarslodockerRemovingusermarslofromgroupdocker$idmarslouid=1100(marslo) gid=1100(marslo) groups=1100(marslo)# re-added$sudousermod-aGdockermarslo$idmarslouid=1100(marslo) gid=1100(marslo) groups=1100(marslo),994(docker)$dockerpspermissiondeniedwhiletryingtoconnecttotheDockerdaemonsocketatunix:///var/run/docker.sock:Get"http://%2Fvar%2Frun%2Fdocker.sock/v1.44/containers/json":dialunix/var/run/docker.sock:connect:permissiondenied
root cause
# docker group-id was 990, and it was changed to 994; but the `/var/run/docker.sock` wasn't been changed$ls-asltrh/var/run/docker.sock0srw-rw----1rootredwillow0Mar715:27/var/run/docker.sock
solution
$sudochown-Rroot:docker/var/run/docker.sock$dockerpsCONTAINERIDIMAGECOMMANDCREATEDSTATUSPORTSNAMES# to change all after GID changed$find/-gidOLD_GID!-typel-execchgrpNEW_GID{} \;