I am trying to get Node.Js to currently just login to docker using the command line, but it is unable. It throws: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/auth": dial unix /var/run/docker.sock: connect: permission denied.
I did not have this issue a few months ago. I can login normally via the command line even if I copy and paste the command that was executed. It's running on the same user (according to Pm2). Using sudo journalctl -fu docker.service I get:
Sep 08 12:47:26 ip-***-***-***-***.us-east-2.compute.internal dockerd[29146]: time="2022-09-08T12:47:26.550682576Z" level=info msg="[graphdriver] using prior storage driver: overlay2"
Sep 08 12:47:26 ip-***-***-***-***.us-east-2.compute.internal dockerd[29146]: time="2022-09-08T12:47:26.714078448Z" level=warning msg="Your kernel does not support cgroup blkio weight"
Sep 08 12:47:26 ip-***-***-***-***.us-east-2.compute.internal dockerd[29146]: time="2022-09-08T12:47:26.714630747Z" level=warning msg="Your kernel does not support cgroup blkio weight_device"
Sep 08 12:47:26 ip-***-***-***-***.us-east-2.compute.internal dockerd[29146]: time="2022-09-08T12:47:26.718133212Z" level=info msg="Loading containers: start."
Sep 08 12:47:26 ip-***-***-***-***.us-east-2.compute.internal dockerd[29146]: time="2022-09-08T12:47:26.863709492Z" level=info msg="Default bridge (docker0) is assigned with an IP address *.*.*.*/16. Daemon option --bip can be used to set a preferred IP address"
Sep 08 12:47:26 ip-***-***-***-***.us-east-2.compute.internal dockerd[29146]: time="2022-09-08T12:47:26.901936393Z" level=info msg="Loading containers: done."
Sep 08 12:47:27 ip-***-***-***-***.us-east-2.compute.internal dockerd[29146]: time="2022-09-08T12:47:27.021360720Z" level=info msg="Docker daemon" commit=a89b842 graphdriver(s)=overlay2 version=20.10.17
Sep 08 12:47:27 ip-***-***-***-***.us-east-2.compute.internal dockerd[29146]: time="2022-09-08T12:47:27.021901303Z" level=info msg="Daemon has completed initialization"
Sep 08 12:47:27 ip-***-***-***-***.us-east-2.compute.internal systemd[1]: Started Docker Application Container Engine.
Sep 08 12:47:27 ip-***-***-***-***.us-east-2.compute.internal dockerd[29146]: time="2022-09-08T12:47:27.057783826Z" level=info msg="API listen on /run/docker.sock"
Node 16.17.0, Docker 20.10.17